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

Main IIFE is an arrow function #885

Closed
nemmtor opened this issue Nov 29, 2020 · 5 comments
Closed

Main IIFE is an arrow function #885

nemmtor opened this issue Nov 29, 2020 · 5 comments

Comments

@nemmtor
Copy link

nemmtor commented Nov 29, 2020

I'm submitting a bug report

Webpack Version:
5.8.0
Babel Core Version:
7.12.9
Babel Loader Version:
8.2.2
Please tell us about your environment:
Linux

Current behavior:
Basically all works good but the whole bundle is wrapped inside IIFE which is an arrow function, I think it shouldn't be like that since im using babel properly - with @babel/preset-env

Expected/desired behavior:
Wraps bundle in IIFE normal func

@vvscode
Copy link
Contributor

vvscode commented Dec 1, 2020

Same for me .

    "@babel/core": "^7.12.9",
    "@babel/preset-env": "7.12.1",
    "babel-loader": "8.2.2",
    "webpack": "^4.44.2",
    "webpack-cli": "^4.2.0",

Just one point - on webpack 4.44.2 it gives normal function

@vvscode
Copy link
Contributor

vvscode commented Dec 1, 2020

@nemmtor it's not loader issue, this function is provided by webpack itself

the link https://webpack.js.org/configuration/output/#outputenvironment was really helpful

  output: {
    path: path.resolve(__dirname, './dist'),
    filename: 'index_bundle.js',

    // next do the trick
    environment: {
      arrowFunction: false, // <-----
    }
  },

@nicolo-ribaudo
Copy link
Member

Yup, that's injected by webpack after running Babel.

I'm keeping this open in case anyone wants to add a mention of this problem and how to solve it to the README.

@vvscode
Copy link
Contributor

vvscode commented Dec 1, 2020

I will make a PR today

@JLHwung
Copy link
Contributor

JLHwung commented Dec 15, 2020

Fixed in #886

@JLHwung JLHwung closed this as completed Dec 15, 2020
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

4 participants