I want to publish module, which depends on react. I want to use this module in my project app, which also relies on reaction. I have the following module configuration for webpack:
module.exports = {
externals: {
'react': 'react'
},
output: {
library: 'my-module',
libraryTarget: 'umd'
},
resolve: {
extensions: ['', '.js'],
fallback: [path.join(__dirname, 'node_modules')]
},
resolveLoader: {
fallback: [path.join(__dirname, 'node_modules')]
}
};
package.json responds to both dependency and peerDependency, and has lib / index.js as an entry point, so I am creating a library for lib / index.js.
Then I start npm linkfrom the module directory and npm link my-modulefrom the directory app. However, it still finishes downloading two different versions of React, which causes problems. How to make my module use the same as the application?
peerDepenencies npm: https://webpack.imtqy.com/docs/troubleshooting.html#npm-linked-modules-doesn-t-find-their-dependencies
, , ( , , ). ?