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

Disable @babel/preset-env #569

Closed
lpeliberty opened this issue Apr 25, 2019 · 2 comments
Closed

Disable @babel/preset-env #569

lpeliberty opened this issue Apr 25, 2019 · 2 comments

Comments

@lpeliberty
Copy link

Hello, i'm having trouble with my project :
I'm using Limenius ReactBundle for SSR with a React app. To do this, i installed v8js on my server, but according to this issue#29, it seems that i need to disable babel-polyfill for server-side JS code.
If i understand well, now @babel/preset-env include @babel/polyfill, and as it seems, @babel/preset-env is auto loaded with webpack-encore (i'm on v0.27.0) isn't it ?
If i'm right, is there a solution to disable @babel/preset-env in webpack-encore plz ?

Here is my webpack.config.js

const Encore = require('@symfony/webpack-encore');

Encore
  .setOutputPath("web/build/front/")
  .setPublicPath('/build/front')
  .addEntry("server-bundle", "./path/to/src/index.js")
  .enableReactPreset()
  // .configureBabel(babelConfig => {
  //   babelConfig.presets.push('airbnb');
  //   babelConfig.plugins.push('@babel/plugin-proposal-class-properties');
  //   babelConfig.plugins.push('transform-react-remove-prop-types');
  // })
  .cleanupOutputBeforeBuild()
  .disableSingleRuntimeChunk();

myApp = Encore.getWebpackConfig();
myApp.name = 'myApp';

module.exports = [myApp];
@lpeliberty lpeliberty changed the title Disable babel preset env Disable @babel/preset-env Apr 25, 2019
@Lyrkan
Copy link
Collaborator

Lyrkan commented Apr 25, 2019

Hi @lpeliberty,

@babel/polyfill is not included in @babel/preset-env so you shouldn't have any polyfill unless you add it manually to your project (or rather core-js since @babel/polyfill is deprecated) and enable the feature using the useBuiltIns/core-js options.

From what I'm understanding of the issue you linked, the error is triggered by importing @babel/polyfill in a way that isn't supported by the ReactBundle.

If you are not doing that, you are probably facing a different problem.

Anyway, if you want to check that, you can disable @babel/preset-env by removing it from the babelConfig.presets array in your Encore.configureBabel() call, or through a custom .babelrc/.babelrc.js file.

@lpeliberty
Copy link
Author

Ok thx for infos ! I tried without @babel/preset-env and i still have my error...

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

2 participants