Closed chkpnt closed 4 years ago
As stated in the error - 'import' and 'export' may only appear at the top level of your file. In other words, import/export don't work inside {}.
You can use CommonJS syntax instead:
let bla = {
doSomething: function() {
console.log("this is " + this);
}
}
module.exports = bla;
const bla = require("./foobar");
bla.doSomething();
Quote from readme - Do not use this option if source code contains ES module import(s)
Thanks for the clarification! 👍
Expected Behavior
According to #39,
imports-loader
should work with ES6 modules.Actual Behavior
I see the same issue as described in #39:
Code
Please see the demonstration repo at https://github.com/chkpnt/imports-loader-issue.
How Do We Reproduce?
Just execute
npm run-script dev
in the demonstration repo.