The scenario is that I'm developing a component for use by a website and want to combine the files that I've created into one index.js
for ease of use.
File index.jsx
includes the line var header = require('./header.jsx');
and header.jsx
includes the line var React = require('react');
where React
has been added as an npm module.
If I use webpack --module-bind jsx --entry .\\src\\index.jsx --output-file .\\dist\\index.js
on the command line this produces a large file with React
source included.
Is there a way that I can have just my index.jsx
and header.jsx
transformed and concatenated?
You can mark React as an external to achieve that. Ie.
externals: {
react: 'react',
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.