When webpack is packaged, do not package dependencies

as the title

developed a npm package based on react, but because there is

in the code

import React from "react";

so react is also packaged when it is packaged, resulting in a very large package size

now, when you want to pack a package, you don"t want to call in the dependency of react. Do you have any solutions?

Mar.30,2021

do you use webpack to pack?

try external?

module.exports = {
  //...
  externals: {
    React: 'react'
  }
};
For more information on the usage of

, please see idebar/Sidebar.jsx" rel=" nofollow noreferrer "> https://webpack.js.org/config.

.

extract the general module of course

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3a9c2-2ba7d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3a9c2-2ba7d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?