bundleNodeModules results in Error: 'default' is not exported
johannes-z opened this issue · 7 comments
Stack Trace:
Error: 'default' is not exported by ..\..\..\..\node_modules\vue-infinite-loading\dist\vue-infinite-loading.js
I'm trying to create bundles with esm
and umd
, but the build fails because apparently the library I'm using doesn't export default
. Apparently the library dist file is an umd
file:
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.VueInfiniteLoading=e():t.VueInfiniteLoading=e()}
Issue-Label Bot is automatically applying the label bug
to this issue, with a confidence of 0.84. Please mark this comment with 👍 or 👎 to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
Can you provide more information,
I just tested everything with vue-infinite-loading
and it works fine.
I was able to get umd and esm bundle output.
What's the command you are running? or your config file
@hosein2398 Sorry yes you are right, I tried a minimal repro, and there it worked. There must be something wrong with the monorepo setup I got at work. I'll try to repro it again before I close this issue though
@hosein2398 I'm pretty sure it's because of the yarn-monorepo setup I have. It doesn't seem to resolve the symlinks correctly. See the path: ..\..\..\..\node_modules\vue-infinite-loading\dist\vue-infinite-loading.js
.
Please check out this repo: https://github.com/johannes-z/bili-yarn-monorepo
You need yarn, just run yarn
in the root and npx bili
in the flexgrid package folder. It should fail with the above error message.
I added this to bili.config.ts
, which seems to resolve this issue. I'm not sure if this is correct however.
extendRollupConfig: config => {
config.inputConfig.preserveSymlinks = true
return config
},
Actually this only worked, because I was building an esm
bundle. Building umd
still fails with the same error.
Adding exclude
to the babel plugin seems to work, but this obviously seems like a dirty hack.
babel: {
exclude: /node_modules\/(?:vue-infinite-loading)/gi,
},
Also, is this setting merged with the default exclude option?
Line 21 in fccb87f