Error:
SyntaxError: Missing export 'createTest2' in ES module: node_modules/test/build.js
at Object.(xxx.js:1)
Reproducable structure:
require = require('esm')(module)
requireModule('./xxx')
node_modules/testimport { createTest2 } from 'test'
node_modules/test/index.jsmodule.exports = require('./build')
node_modules/test/build.jsexports.createTest1 = function () {};
exports.createTest2 = function () {};
Example:
https://github.com/vuejs/vue/blob/dev/packages/vue-server-renderer/index.js#L16
https://github.com/vuejs/vue/blob/dev/packages/vue-server-renderer/build.js#L8641-L8642
Hi @clarkdo could you create a simple repro repo.
@jdalton https://github.com/clarkdo/esm-issue-report
I found the error only occurred when import same file but different exported things multiple times.
First import: https://github.com/clarkdo/esm-issue-report/blob/master/core/index.js#L1
Second: https://github.com/clarkdo/esm-issue-report/blob/master/core/renderer.js#L1
Thanks @clarkdo!
This appears to be fixed in our master branch :tada:
@jdalton Thank you so much for the fast fix 馃樃
@jdalton looks like I've faced that or similar issue on 3.0.36 with package randomstring.
SyntaxError: Missing export 'generate' in ES module: file:///.../node_modules/randomstring/lib/randomstring.js.
When I do import { generate as random } from 'randomstring'. (possible caused by this re-export)
I can believe that this may be an improper use of import by mine, but this works previously on major esm@3 til recent time.
@StreetStrider it's likely totally my bad _(esm loader regression)_ and not something you've done. I should have a release out today that hopefully resolves the issue.
Update:
v3.0.37 is released :tada:
Sorry, I've tried 3.0.37 when its out, havent any time to post this. Now esm nagging on export { default } from './Outcome' with Missing export 'default' in ES module: file:///.../src/Outcome/index.js where static typing doesn't find any problem one step earlier. I use this when I want re-export Smth/Smth.js as Smth/index.js.
Hard fixed with "esm": "3.0.34", for now.
Hi @StreetStrider!
Could you create a repro repo for me to check out and file a new issue.
~@jdalton, will do.~ Already fixed.
Confirm that fixed in #422 :+1:
Most helpful comment
@StreetStrider it's likely totally my bad _(
esmloader regression)_ and not something you've done. I should have a release out today that hopefully resolves the issue.Update:
v3.0.37 is released :tada: