-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Behaviour of ncc'd libraries requiring code dynamically #479
Comments
Can you elaborate on what you mean? All of our main builders are indeed compiled via ncc, and the exports remain intact. Also, this simple example preserves the exports: // t.js
exports.foo = 'bar'; $ ncc build t.js
1kB dist/index.js
1kB [285ms] - ncc 0.16.0 > require('./dist')
{ foo: 'bar' } |
Interesting. I was using TS and all I got was this: console.log(require('...'));
{ } I need to try to find the min reproduction of the issue. I was using several exports and a default export. Once that didn't work I also tried to reproduce TS-like exports in the node.js way but I was still getting an empty object. |
Ok the issue seems to be related to Let's say you have project-1 that is built with Then project-2 uses |
I have a very interesting repro without https://files-8mwa86l42.now.sh
I'm running here first the Now things get really interesting if I execute the module compiled with
|
Here is the code so you don't necessarily need to open the tar file: index.js
test/index.js
test/index.ts
|
Further on it seems this occurs if I |
The command line interface adds a lot of bulk to Micri and causes weird issue with ncc vercel/ncc#479 Also the command line interface is likely slower to execute than a single direct non-dynamic require.
The command line interface adds a lot of bulk to Micri and causes weird issue with ncc vercel/ncc#479 Also the command line interface is likely slower to execute than a single direct non-dynamic require.
Yeah I think I may be running into this when trying to use the eslint cli packaged in for a github action? |
It seems that by default
ncc
(or webpack) isn't configured to preserve exports. Is it possible to do that?The text was updated successfully, but these errors were encountered: