Code Monkey home page Code Monkey logo

swc-webpack-plugin's People

Contributors

imsobear avatar soulwu avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

guoyunhe

swc-webpack-plugin's Issues

error: 'delete' cannot be called on an identifier in strict mode

Hi! I tried out swc-webpack-plugin on my project and ran into a problem where swc interprets a non-strict third-party module as if it were in strict mode, leading to incorrect errors. This might be an swc bug but I figured Iโ€™d ask you first.

Minimal reproduction:

package.json

{
  "dependencies": {
    "@swc/core": "^1.2.57",
    "sorttable": "^1.0.2",
    "swc-webpack-plugin": "^1.0.0",
    "webpack": "^5.37.1",
    "webpack-cli": "^4.7.0"
  }
}

webpack.config.js

const { SWCMinifyPlugin } = require("swc-webpack-plugin");

module.exports = {
  optimization: {
    minimize: true,
    minimizer: [new SWCMinifyPlugin()],
  },
};

src.js

require("sorttable");

Output

$ npx webpack
error: 'delete' cannot be called on an identifier in strict mode
  --> <anon>:80:14
   |
80 |       delete sortbottomrows;
   |              ^^^^^^^^^^^^^^

error: 'delete' cannot be called on an identifier in strict mode
   --> <anon>:166:17
    |
166 |             delete row_array;
    |                    ^^^^^^^^^

error: 'delete' cannot be called on an identifier in strict mode
   --> <anon>:261:12
    |
261 |     delete newrows;
    |            ^^^^^^^

[webpack-cli] HookWebpackError: failed to process js file

Caused by:
    failed to parse module: error was recoverable, but proceeding would result in wrong codegen
    at makeWebpackError (/home/anders/zulip/test/swc-test/node_modules/webpack/lib/HookWebpackError.js:49:9)
    at /home/anders/zulip/test/swc-test/node_modules/webpack/lib/Compilation.js:2495:12
    at eval (eval at create (/home/anders/zulip/test/swc-test/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:33:1)
-- inner error --
Error: failed to process js file

Caused by:
    failed to parse module: error was recoverable, but proceeding would result in wrong codegen
caused by plugins in Compilation.hooks.processAssets
Error: failed to process js file

Caused by:
    failed to parse module: error was recoverable, but proceeding would result in wrong codegen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.