I'm working on a Webpack/VueCLI project which will serve javascript files for an external application. These files will be served to different 'projects', one file per project, and I'd like to have some common functionality in a base file, which is included in the project file.
I initially thought to have webpack's module/import handling do this:
//base.js
console.log('Base functionality')
//project-a.js
import './base.js';
console.log('Project functionality');
But this doesn't behave the way I want: Webpack resolves the modules, wraps them up in its own __webpack_require__
functionality, etc.
I think what I really want is more like old-fashioned server-side includes: so the JS loader simply imports the contents of base.js
wholesale and drops it into project-a.js
at the appropriate spot.
Is there a way to make webpack/node (or something) do this?
from Is there something equivalent to a file 'include' in webpack/node?
No comments:
Post a Comment