Open Announcement opened 7 years ago
Can you provide more details? What do your rollup.config.js
, .babelrc
, and expected vs actual output look like?
I have same issue with a clean installation (latest version of this package and Rollup).
My Gulp task:
function task() {
const rollupOptions = {
entry: './app/scripts/scripts.js',
plugins: [$.babel({ // babel === rollup-plugin-babel
babelrc: false,
presets: ['es2015-rollup']
})],
cache: bundleCache
};
return $.rollup.rollup(rollupOptions).then((bundle) => {
bundleCache = bundle;
return bundle.write({
sourceMap: true,
format: 'iife',
dest: 'build/scripts/scripts.bundle.js'
});
}).catch(rollupErrorHandler);
}
After run:
Error: Error transforming app/scripts/scripts.js with 'babel' plugin: It looks like your Babel configuration specifies a module transformer. Please disable it. If you're using the "es2015" preset, consider using "es2015-rollup" instead. See https://github.com/rollup/rollup-plugin-babel#configuring-babel for more information
Does this continue to fail even when you run rm -rf node_modules && npm install
?
@eventualbuddha, Yes, I deleted the directory and installed all the dependencies again.
$ npm cache clean all
$ rimraf .tmp node_modules bower_components build
$ npm i
My workspace:
Finally got it to work with this:
{
"presets": [
[
"es2015",
{
"modules": false
}
]
],
"plugins": ["external-helpers"]
}
import json from 'rollup-plugin-json';
import babel from 'rollup-plugin-babel';
export default {
entry: 'src/ntemplate.js',
format: 'cjs',
plugins: [ json(), babel() ],
dest: 'index.js'
};
I just started running into this. It's possible it's an npm version issue - the modify-babel-preset
plugin uses require-relative
but fails to specify a base path, so it will attempt to require babel-preset-es2015
from the process.cwd()
. If the es2015
preset is not reachable from the cwd
, the error message in the OP will be printed.
I had the same problem with babel-preset-es2015-rollup
, it turned out this was the problem of modify-babel-preset
under Windows. I've pushed small PR fixing this https://github.com/developit/modify-babel-preset/pull/10. PR was merged but it is released under 3.0.0
version of modify-babel-preset
. It won't be installed since package.json
specifies ^2.1.1
version.
It's not just an issue under windows, I'm experiencing the issue on other OSes as well.
There are two fixes in the modify-babel-preset repo since 2.1.1, released under version 3.0.0. I think those are relevant changes, forcing 3.0.0 fixed my issues on windows.
I'm working with a colleague who is on Windows and his project wouldn't build because of this. Updating modify-babel-preset
did not fix it, but switching babel-preset-es2015-rollup
with babel-preset-es2015
and the config above solved the problem.
rollup-plugin-babel
now recommends using babel-preset-2015
and babel-plugin-external-helpers
as @Announcement suggests instead of this package.
If anyone is still experiencing this, can you try the latest babel-preset-es2015-rollup
preset? It no longer uses modify-babel-preset
because that was causing some issues.
I'm thinking this issue is actually related to this package, not rollup. https://github.com/rollup/rollup/issues/842 After disabling
['es2015-rollup']
everything seems to work fine, but the module is no longer in ecma 5 since this had to be disabled. Any ideas why this is happening?