Closed cjh9 closed 5 years ago
hey @cjh9
esm is in one instance ending up in some frontend code and is trying to import a svg-file.
that shouldn't happen, as esm
is meant to support es6 modules for node.js only. your front end app should not hook into the node.js (commonjs bridge) entry file, but the es6 file the bridge is loading.
to illustrate:
// something like this is the entry point for node.js only!
// index.js
require = require("esm")(module/*, options*/)
module.exports = require("./main.js")
// something like this should be referenced by your front end app
// main.js
export {}
I'm creating a large isomorphic js-application with node on the backend. Esm is in one instance ending up in some frontend code and is trying to import a svg-file. It is normally imported and inlined by a webpack-svg-loader in the frontend.
Error message:
Is it possible to tell esm to ignore some files? I tried to hook into require by doing:
But it doesn't work, esm is already taking care of that. I would like to be able to still use the second option in "Getting started" in the readme-file,
nodemon -w server -w common -r esm server/main.js
and not create an additionalindex.js
file as explained in the first option in "Getting started".index.js
Is there any possibility to do this?