hard-source-webpack-plugin icon indicating copy to clipboard operation
hard-source-webpack-plugin copied to clipboard

When I build in dev and then in prod, I get errors in the produced JS

Open ghusse opened this issue 7 years ago • 2 comments

Expected Behavior

No error while building, and no errors in the browser

Actual Behavior

An error when building with mode: prod, after a build with mode: dev

Unexpected token: punc (,) [./node_modules/@angular/common/locales/fr.js:22,0][app.bundle.js:101739,4]

Is an error being thrown?

Not by the plugin itself

Steps to Reproduce

On my project:

webpack --progress --output-pathinfo --watch --mode development
// And then
webpack --run-prod --mode production

And I get this error in the console.

If I remove the cache from hard-source, after the 1st build, the 2nd build works.

If I run builds in the reverse order, I don't get an error in the console, but the same error is thrown in the browser.

If I then remove the cache from hard-source and launch the build again, it works.

Operating System, Node, and NPM dependency versions

Ubuntu linux 18.04.1 LTS
Node 10.14.1

Dependencies related to webpack:

    "clean-webpack-plugin": "^0.1.17",
    "css-loader": "^1.0.0",
    "extract-text-webpack-plugin": "^3.0.2",
    "file-loader": "^2.0.0",
    "hard-source-webpack-plugin": "^0.12.0",
    "html-loader": "^0.5.1",
    "html-webpack-plugin": "^2.30.1",
    "img-loader": "^3.0.0",
    "node-sass": "^4.9.3",
    "raw-loader": "^0.5.1",
    "sass-loader": "^7.1.0",
    "string-replace-loader": "^2.1.1",
    "style-loader": "^0.23.0",
    "to-string-loader": "^1.1.5",
    "ts-loader": "^5.1.0",
    "webpack": "^4.20.2",
    "webpack-bundle-analyzer": "^2.13.1",
    "webpack-cli": "^3.1.0",
    "webpack-dev-server": "^3.1.9",
    "webpack-manifest-plugin": "^1.3.2",
    "webpack-shell-plugin": "^0.5.0"

ghusse avatar Dec 03 '18 11:12 ghusse

https://github.com/mzgoddard/hard-source-webpack-plugin/issues/443

Your version of webpack is not compatible with hard-source-webpack-plugin

Legym avatar Dec 05 '18 15:12 Legym

Thanks for your answer. I'll test with the latest version of webpack. But for what I saw in the ticket, it seems to be an issue with versions ≥ 4.19

ghusse avatar Dec 05 '18 16:12 ghusse