-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Error: 'default' is not exported by node_modules/conf/index.js #78
Comments
Hey there. Thanks for reaching out. The issue you are currently experiencing is unrelated to I'll gladly help you out anyway. 😊 First and foremost, the So you'll need to add the Now, moving on from that, I see you are targeting CommonJS but are attempting to bundle your external dependencies. Unless you have a good reason to do it, with Rollup, you generally pass the module specifiers to your external dependencies to Rollup with the export default {
// ...
external: [
"conf"
]
} That way, a The general convention with Rollup is to mark all of your dependencies from your As I hope is clear by now, Rollup understands ESM and only ESM, and everything else - CommonJS, JSON, UMD, AMD, etc, needs separate plugins to work,but it is not always possible or feasible to rewrite that into ESM. If you still want to inline the Hope this helps! Feel free to get back to me with any questions you might have, but given that this has no relation to |
I really appreciate you taking the time to write this reply and help me out. My use case is somewhat unusual. I'm using node to create a 'workflow' for a Mac It is located here. Unfortunatly I already rely on
That looks like a great resource, I been playing around with it and it would How could I internalize my dependencies? // rollup.config.ts
import { builtinModules } from 'module';
import { cjsToEsm } from '@wessberg/cjs-to-esm-transformer';
import { terser } from 'rollup-plugin-terser';
import filesize from 'rollup-plugin-filesize';
import json from '@rollup/plugin-json';
import pkg from './package.json';
import resolve from '@rollup/plugin-node-resolve';
import sourceMaps from 'rollup-plugin-sourcemaps';
import typescript from '@wessberg/rollup-plugin-ts';
const libraryName = 'alfred-workflow-todoist';
let plugins = [
json(),
resolve(),
typescript({
transformers: [cjsToEsm()],
// transpiler: 'babel',
}),
sourceMaps(),
filesize(),
];
if (process.env.NODE_ENV === 'production') {
plugins = [...plugins, terser()];
}
export default {
input: `src/${libraryName}.ts`,
output: [{ file: pkg.main, format: 'cjs', sourcemap: 'inline' }],
watch: {
include: 'src/**',
},
external: [
...builtinModules,
...Object.keys(pkg.devDependencies),
],
plugins: plugins,
}; Which externalizes all my dependencies.
Again thanks for your patience, your work and your time. Martien |
Hi again. It's completely fine that you ask! I'm happy to help. Haha, yes, it is indeed
If you have a And since you do want to inline all of your external dependencies, the change the external: [
...builtinModules
] You'll need v0.0.17 of |
Hi!
I'm stuck, and I'm not sure where to look to further debug the issue. I'n not exactly sure this is a problem with this plugin but it seems plausible.
Terminal output:
I've had to move to
node 10
to find this problem and am currently onv10.18.1
. The easiest way to install it was through homebrew.I have tried creating named export in the commonjs plugin (
namedExports: { conf: ['Conf'] }
) as suggested here with no avail. I've also tried a more minimal repro:But this builds just fine. So it must be something with the 'conf' module right? It does do some require trickery here.
Or maybe something with babel and
@babel/preset-env
? However the error seems to hint at a problem with one of the rollup plugins. I am at a loss to debug this any further so I was rather hoping you or any would know how to find the root cause of the problem.My setup:
I've attached a repro:
rollup-bug.zip
Martien
EDIT: removed comments on failing on specific node versions, it's failing the same on all tested version now.
The text was updated successfully, but these errors were encountered: