Skip to content

🐛Parcel do not transpile some ES6+ code in node_modules  #1037

Description

@item4

Choose one: is this a 🐛 bug report or 🙋 feature request?

🐛bug

🎛 Configuration (.babelrc, package.json, cli command)

// .babelrc
{
  "presets": [
    ["env", {
      "targets": {
        "browsers": ["IE 9"]
      }
    }]
  ],
}
// package.json
{
  "name": "pc",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "devDependencies": {
    "babel-core": "^6.26.0",
    "babel-preset-env": "^1.6.1",
    "parcel-bundler": "^1.6.2"
  },
  "private": true,
  "scripts": {
    "build": "parcel build src/index.js"
  },
  "dependencies": {
    "sweetalert2": "^7.17.0"
  }
}
# command
$ yarn build

🤔 Expected Behavior

build result must have no arrow function in because I'm set target to IE 9 and IE 9 do not support arrow function.

😯 Current Behavior

I can find arrow function easliy in build result.

💁 Possible Solution

use webpack (webpack@4 and babel@7)

🔦 Context

I tried to use babel-preset-env, babel-preset-latest, babel-plugin-es2015-arrow-function(blabla) but there is no effect.

💻 Code Sample

import swal from 'sweetalert2';

(async () => {
  await swal('hello');
})().then();

🌍 Your Environment

Software Version(s)
Parcel parcel-bundler@1.6.2 and 1.7.0
Node v9.7.1
npm/Yarn yarn 1.5.1
Operating System macOS 10.13.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions