Skip to content
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

Plugin/Preset files are not allowed to export objects, only functions. In /dir... #165

Closed
mylastore opened this issue Sep 25, 2018 · 10 comments

Comments

@mylastore
Copy link

mylastore commented Sep 25, 2018

Using node 10.11.0
Gulp 4
I get this error Plugin/Preset files are not allowed to export objects, only functions. In /dir...

I have not made any changes to NPM or gulp and getting this on several projects that I run Gulp 4 and gulp-babel.

Can anyone tell me what I need to do?

@loganfsmyth
Copy link
Member

Essentially what this means is that one of your presets isn't compatible with Babel 7. I'd look through and if there are any babel- presets in the 6.x range, you'll want to update them to @babel/ presets in the 7.x range.

@mylastore
Copy link
Author

but I have not changed anything on like 4 different local apps and suddenly all of them are getting that error when I gulped. They had been working and nothing has also at work I have the same setup.

@loganfsmyth
Copy link
Member

Did you intend to use Babel 7? That error implies that you're using Babel 7, so if you didn't upgrade on purpose, something in your configuration must have changed somewhere. It is hard to say more without knowing your dependencies and build steps though.

@mylastore
Copy link
Author

mylastore commented Sep 25, 2018

Nothing has changed in the project is weird here at home like I said 4 different apps and at work one, first I got this at work today, and when I get home I gulp on a similar setup and same error. Anyways let take a look at what you are saying regarding babel version.

I have this

    "gulp-babel": "^8.0.0",
    "@babel/core": "^7.0.0-beta.46",
    "@babel/preset-env": "^7.0.0-beta.46",
    "babel-loader": "8.0.0-beta.0",
    "babel-plugin-transform-es2015-template-literals": "^6.22.0",
    "babel-preset-es2015": "^6.24.1",
    "gulp": "^4.0.0",

@loganfsmyth
Copy link
Member

That configuration is definitely not right.

    "babel-plugin-transform-es2015-template-literals": "^6.22.0",
    "babel-preset-es2015": "^6.24.1",

are both Babel 6, so they definitely won't work with gulp-babel@8.x or babel-loader@8.x.

What is your Babel config? It'd either be a .babelrc or in your Gulp config as arguments for gulp-babel / babel-loader.

@mylastore
Copy link
Author

"es2015"

@loganfsmyth
Copy link
Member

es2015 is for Babel 6. If you are using Babel 7, you should use { presets: ["@babel/preset-env"] } in your config.

@steinhaug
Copy link

Make sure you are not using both v7 and v6 branch og babel. The "@babel/core" is the 7x branch and the "babel/core" is the 6x branch, you should not have both installed at once!

@shawn-s-feng-nj
Copy link

but I have not changed anything on like 4 different local apps and suddenly all of them are getting that error when I gulped. They had been working and nothing has also at work I have the same setup.

Using node 10.11.0
Gulp 4
I get this error Plugin/Preset files are not allowed to export objects, only functions. In /dir...

I have not made any changes to NPM or gulp and getting this on several projects that I run Gulp 4 and gulp-babel.

Can anyone tell me what I need to do?

I have the same question, how did you solve it ?

@Juniuz
Copy link

Juniuz commented Sep 25, 2019

but I have not changed anything on like 4 different local apps and suddenly all of them are getting that error when I gulped. They had been working and nothing has also at work I have the same setup.

Using node 10.11.0
Gulp 4
I get this error Plugin/Preset files are not allowed to export objects, only functions. In /dir...
I have not made any changes to NPM or gulp and getting this on several projects that I run Gulp 4 and gulp-babel.
Can anyone tell me what I need to do?

I have the same question, how did you solve it ?

As @loganfsmyth said, if you are using Babel core v7 use { presets: ["@babel/preset-env"] } in your gulpfile.js config, otherwise use { presets: ['es2015'] } if you're using Babel core v6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants