Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
408 views
in Technique[技术] by (71.8m points)

webpack - Forcing one project to use the ReactJS bundles of another project

I have two projects, A and B, both developed with ReactJS each have its separate bundle file, which means duplicated React after build. but A calls B in itself (not iframe).

Is there any way to bundle ReactJS only in project A and exclude it from B's bundling? I use Webpack as the bundler in both projects.

Update: I face this error while running project A, When I use externals like below,

externals: {
    'react': 'React',
    'react-dom': 'ReactDOM',
}

bundle.js:1 Uncaught ReferenceError: React is not defined

question from:https://stackoverflow.com/questions/65937385/forcing-one-project-to-use-the-reactjs-bundles-of-another-project

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...