Error: Unexpected token build/node_modules/mongoose/package.json (2:8)
SMotaal opened this issue · 1 comments
SMotaal commented
I'm trying to bundle "mongoose" for the first time and I am getting this very odd error when using node-resolve:
[!] Error: Unexpected token
build/node_modules/mongoose/package.json (2:8)
1: {
2: "name": "mongoose",
^
3: "description": "Mongoose MongoDB ODM",
4: "version": "5.2.3",
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Here is my rollup.config:
const moduleDirectory = 'build/node_modules';
export default {
optimizeChunks: true,
experimentalCodeSplitting: true,
external: module.constructor.builtinModules,
input: {
mongoose: `./${moduleDirectory}/mongoose/index.js`,
},
output: {
dir: 'build/bundles',
format: 'es',
sourcemap: true,
interop: false,
entryFileNames: `[name].m.js`,
chunkFileNames: `chunks/[name].m.js`,
},
plugins: [
nodeResolve({
// browser: true,
// main: true,
// preferBuiltins: true,
jail: moduleDirectory,
customResolveOptions: {
moduleDirectory,
},
}),
commonjs(),
],
};
SMotaal commented
Just needed 'rollup-plugin-json'... Why does that make sense 🥇