I will explain what I'm trying to do just in case I'm going about this the wrong way and there's a better way.
Here's my situation:
- I'm building a simple "component-building" CMS in Express.js and React.js
- I want to reuse "base code" across multiple repositories. (This includes Webpack config, Express.js server code, and some client-side admin interface)
- I also want project-unique code in each repository.
- I expect bugs or feature requests of the "base code" to appear when I have multiple projects with the same setup
My goal:
- I want to fix the bug/add the feature and then only update an npm module in each project - not any manual copy paste work.
My problem
Since I will need webpack configs, client-side React components, and express.js server-side code in an npm module I assume it also means I have to run parts of the app from inside node_modules.
For example this file structure:
project-root/
package.json
custom-settings.js
node_modules/
mymodule/
webpack.config.js
index.js
I would run something like:
node ./node_modules/mymodule/index.js
and then reference project-unique settings/components from outside node_modules with:
import customSettings from '../../custom-settings'
My question
Apart from the risk that the file doesn't exist, would any issues arise from this approach? customSettings wouldn't have to affect the build setup, only add custom components or simple CMS options - things like that.
via Andreas Nilsson
No comments:
Post a Comment