spencermountain / unrequired

find unused javascript files in your project
108 stars 8 forks source link

(plugin babel) Error: Rollup requires that your Babel configuration keeps ES6 module syntax intact. #9

Open arryanggaputra opened 5 years ago

arryanggaputra commented 5 years ago
unrequired index.js

Compiling the javascript..

npx: installed 4 in 2.236s
[!] (plugin babel) Error: Rollup requires that your Babel configuration keeps ES6 module syntax intact. Unfortunately it looks like your configuration specifies a module transformer to replace ES6 modules with another module format. To continue you have to disable it.

Most commonly it's a CommonJS transform added by @babel/preset-env - in such case you should disable it by adding `modules: false` option to that preset (described in more detail here - https://github.com/rollup/rollup-plugin-babel#modules ).
index.js
Error: Rollup requires that your Babel configuration keeps ES6 module syntax intact. Unfortunately it looks like your configuration specifies a module transformer to replace ES6 modules with another module format. To continue you have to disable it.

Most commonly it's a CommonJS transform added by @babel/preset-env - in such case you should disable it by adding `modules: false` option to that preset (described in more detail here - https://github.com/rollup/rollup-plugin-babel#modules ).
    at error (/Users/arryangga/.npm/_npx/6987/lib/node_modules/rollup/dist/rollup.js:10151:30)
    at throwPluginError (/Users/arryangga/.npm/_npx/6987/lib/node_modules/rollup/dist/rollup.js:16454:12)
    at Object.error (/Users/arryangga/.npm/_npx/6987/lib/node_modules/rollup/dist/rollup.js:16509:24)
    at Object.error (/Users/arryangga/.npm/_npx/6987/lib/node_modules/rollup/dist/rollup.js:16901:38)
    at /usr/local/lib/node_modules/unrequired/node_modules/rollup-plugin-babel/dist/rollup-plugin-babel.cjs.js:73:9
    at /usr/local/lib/node_modules/unrequired/node_modules/rollup-plugin-babel/dist/rollup-plugin-babel.cjs.js:202:20

fs.js:126
    throw err;
    ^

Error: ENOENT: no such file or directory, open '/usr/local/lib/node_modules/unrequired/_tmp-build.js.map'
    at Object.openSync (fs.js:447:3)
    at Object.readFileSync (fs.js:349:35)
    at getUsed (/usr/local/lib/node_modules/unrequired/src/get-used.js:13:29)
    at unrequired (/usr/local/lib/node_modules/unrequired/src/index.js:9:14)
    at Object.<anonymous> (/usr/local/lib/node_modules/unrequired/src/bin.js:20:14)
    at Module._compile (internal/modules/cjs/loader.js:868:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)
    at Module.load (internal/modules/cjs/loader.js:731:32)
    at Function.Module._load (internal/modules/cjs/loader.js:644:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:931:10) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/usr/local/lib/node_modules/unrequired/_tmp-build.js.map'
}
spencermountain commented 5 years ago

hi Arryangga, i'll have to know more about the codebase you're trying to run. I'm really no expert in rollup errors!

ethicalvats commented 5 years ago

Facing same issue! @arryanggaputra are you running it on react/react-native app ?? it has something to do with babel.config.js as it clearly says need to turn off the module transformation so I am playing with this setting

presets: ['module:metro-react-native-babel-preset'],

If I will find some solution will share

spencermountain commented 5 years ago

thanks @ethicalvats i'd be happy to support any solution you can find. Maybe this script should hunt-around in some obvious places for node_modules and babel configs. It's up to you cheers

matthewbal commented 3 years ago

I also had this issue running on a mid sized react native project, did you find a solution @ethicalvats ?

spencermountain commented 3 years ago

hey @matthewbal you may have more luck with smeijer/unimported it seems to do everything, i'm gonna add it to the top of the readme for this project. cheers