I'm relatively new to modern JS development and I need help or advice about this situation I'm in.
Situation: We have a React-Typescript-Redux project supporting IE8 (React 0.14). Now we're upgrading to IE11 and React 16 but IE8 should be supported.
Requirement: Reduce project maintenance between browser versions by using different packages and/ or config files for each build.
Problem: From research I made so far it seems impossible to use different package.json files and node_modules folders inside the same project with selected tools: npm, Webpack, React, Redux, Typescript. Yarn seems to support multiple package.json files but we'd like to avoid migrating from npm if possible.
Current project structure:
project_root/
node_modules/
src/
components/
utils/
index.tsx
components.css
index.html
package.json
tsconfig.json
webpack.config.json
What I thought might work was to introduce IE8 subfolder with its package.json and node_modules folder and then reference that folder for the build task somehow but now I'm oblivious how to tell npm to reference it on build.
Proposed project structure:
project_root/
ie8/
node_modules/
package.json
node_modules/
src/
components/
utils/
index.tsx
components.css
index.html
package.json
tsconfig.json
webpack.config.json
I tried different things found on web, including resolve.modules: [__dirname + "/ie8/node_modules"]
but it seems it doesn't work or I misunderstand what it does because I get Cannot find name 'require'
errors on several files and Typescript 2.8.3 is referenced in terminal output instead 2.3.4. Without it, project builds with configuration for IE11.
So, can anybody tell me with certainty it's not possible or offer some guidance? This is the closest answer I found so far but doesn't sound final. Alternatively, can project structure like this support what is required or separating project into two is the best bet?
Thanks in advance.