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

Error when using with webpack 5 #514

Open
daveisfera opened this issue Oct 30, 2019 · 8 comments
Open

Error when using with webpack 5 #514

daveisfera opened this issue Oct 30, 2019 · 8 comments

Comments

@daveisfera
Copy link

daveisfera commented Oct 30, 2019

Expected Behavior

Can be used with webpack 5 (currently being beta tested)

Actual Behavior

Errors out

Is an error being thrown?

Webpack Bundle Error :::: TypeError: Cannot read property 'tap' of undefined
    at Object.exports.tap (/Users/dlj/projects/my_test/web/node_modules/hard-source-webpack-plugin/lib/util/plugin-compat.js:118:25)
    at new CacheSerializerFactory (/Users/dlj/projects/my_test/web/node_modules/hard-source-webpack-plugin/lib/CacheSerializerFactory.js:94:18)
    at HardSourceWebpackPlugin.apply (/Users/dlj/projects/my_test/web/node_modules/hard-source-webpack-plugin/index.js:219:36)
    at createCompiler (/Users/dlj/projects/my_test/web/node_modules/webpack/lib/webpack.js:62:12)
    at webpack (/Users/dlj/projects/my_test/web/node_modules/webpack/lib/webpack.js:88:14)
    at /Users/dlj/projects/my_test/web/build.js:309:9
    at new Promise (<anonymous>)
    at processConfig (/Users/dlj/projects/my_test/web/build.js:307:12)
    at /Users/dlj/projects/my_test/web/build.js:357:20
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:62:3)
    at /Users/dlj/projects/my_test/node_modules/esm/esm.js:1:33214
    at module.exports.Q.inited.Q.module.utilSilent (/Users/dlj/projects/my_test/node_modules/esm/esm.js:1:32886)
    at process.<anonymous> (/Users/dlj/projects/my_test/node_modules/esm/esm.js:1:33184)
    at Function.<anonymous> (/Users/dlj/projects/my_test/node_modules/esm/esm.js:1:271592)
    at Function.<anonymous> (/Users/dlj/projects/my_test/node_modules/esm/esm.js:1:271332)

Steps to Reproduce

Enable hard-source-webpack-plugin with webpack 5

Operating System, Node, and NPM dependency versions

Mac OS 10.14.6
Node 12.12.0

"devDependencies": {
    "@babel/core": "~7.6.3",
    "@babel/plugin-proposal-class-properties": "~7.5.5",
    "@babel/plugin-proposal-decorators": "~7.6.0",
    "@babel/plugin-proposal-export-default-from": "~7.5.2",
    "@babel/plugin-proposal-export-namespace-from": "~7.5.2",
    "@babel/plugin-proposal-function-bind": "~7.2.0",
    "@babel/plugin-proposal-json-strings": "~7.2.0",
    "@babel/plugin-proposal-object-rest-spread": "~7.6.2",
    "@babel/plugin-syntax-dynamic-import": "~7.2.0",
    "@babel/plugin-syntax-import-meta": "~7.2.0",
    "@babel/plugin-transform-classes": "~7.5.5",
    "@babel/plugin-transform-modules-commonjs": "~7.6.0",
    "@babel/plugin-transform-spread": "~7.6.2",
    "@babel/preset-env": "~7.6.3",
    "@babel/preset-react": "~7.6.3",
    "@babel/register": "~7.6.2",
    "assets-webpack-plugin": "~3.9.10",
    "babel-loader": "~8.0.6",
    "babel-plugin-lodash": "~3.3.4",
    "clean-css": "~4.2.1",
    "css-loader": "~3.2.0",
    "hard-source-webpack-plugin": "~0.13.1",
    "less": "~3.10.3",
    "less-loader": "~5.0.0",
    "simple-progress-webpack-plugin": "~1.1.2",
    "style-loader": "~1.0.0",
    "terser-webpack-plugin": "~2.2.1",
    "thread-loader": "~2.1.3",
    "webpack": "~5.0.0-beta.1"
  } 
@Jurigag
Copy link

Jurigag commented Oct 31, 2019

Have the same issue, did you solve it?

@daveisfera
Copy link
Author

I just disabled this plugin to continue testing with webpack 5

@eugeneoshepkov
Copy link

Isn't new webpack persistent caching making this plugin redundant?

@BuptStEve
Copy link

Isn't new webpack persistent caching making this plugin redundant?

You're right~
webpack/webpack#6527

@yodfz
Copy link

yodfz commented Apr 30, 2020

this is pre webpack5

@alexander-akait
Copy link

You don't need this plugin with webpack@5, because webpack@5 support cache out of box https://webpack.js.org/configuration/other-options/#cache

@wearebear80
Copy link

@mzgoddard Could you please add this information to README.md file?

mfranzke added a commit to mfranzke/patternlab-node that referenced this issue Mar 15, 2021
Webpack 5 supportes module caching out of the box, compare to e.g. mzgoddard/hard-source-webpack-plugin#514 (comment)
JosefBredereck added a commit to pattern-lab/patternlab-node that referenced this issue Jan 30, 2023
…ion 5 & some cleanup (#1301)

* chore(docs): some typos

missed to replace mustache initially and incorrect handlebars two times (both in package name and URL)

* Revert "Merge pull request #2 from pattern-lab/dev"

This reverts commit 7812878, reversing
changes made to 26db979.

* Revert "Merge pull request #1 from pattern-lab/dev"

This reverts commit 26db979, reversing
changes made to fc90750.

* Revert "chore(docs): some typos"

This reverts commit 271dc8d.

* refactor: removed obsolete dependencies

Webpack 5 supportes module caching out of the box, compare to e.g. mzgoddard/hard-source-webpack-plugin#514 (comment)

* refactor: removed code out of obsolete dependency

* refactor: updated clean-css-loader related dependencies

* refactor: updated clean-webpack-plugin dependency

and restructured the code according to johnagan/clean-webpack-plugin#106

* refactor: updated webpack-merge dependency

* refactor: removed obsolete dependencies

this seems to have been removed (intentionally?) by 2cb663d#diff-8c9b7dba764c6bd34aaec36a6a42e7b69d9a46b19712a47706355bb8616d3319L365

* refactor: updated html-webpack-plugin dependency

* refactor: updated node-sass-magic-importer dependency

* refactor: updated style-loader dependency

* refactor: updated svg-sprite-loader dependency

* refactor: updated svg-transform-loader dependency

* refactor: updated svgo-loader dependency

* refactor: updated ts-loader dependency

* refactor: updated webpack-cli dependency

* refactor: updated copy-webpack-plugin dependency

* refactor: updated webpack-dev-middleware dependency

"the logger, logLevel and logTime options were removed without replacement." source: https://github.com/webpack/webpack-dev-middleware/releases?after=v4.0.0-rc.1

* refactor: updated mini-css-extract-plugin dependency

* refactor(webpackdevmiddleware): quiet has been removed a lot earlier even already

* refactor: updated no-emit-webpack-plugin dependency

* refactor: updated webpack dependency

* refactor: rebuild yarn.lock file

* refactor(terserplugin): options had an unknown property 'sourceMap'

* refactor(webpack): clean up configuration

https://webpack.js.org/migrate/5/#clean-up-configuration

* Revert "Merge branch 'dev' into refactor-updated-depencencies-webpack"

This reverts commit 8f347df, reversing
changes made to e619e63.

* refactor(webpack): updated outdated options

optimization.namedChunks: true → optimization.chunkIds: 'named'

source: https://webpack.js.org/migrate/5/#update-outdated-options

* refactor(webpack): updated outdated options

optimization.occurrenceOrder: true → optimization: { chunkIds: 'total-size', moduleIds: 'size' }

source: https://webpack.js.org/migrate/5/#update-outdated-options

* refactor: regenerated yarn.lock

* refactor: updated babel-loader dependency

* refactor: updated svg-sprite-loader dependency

* refactor: updated css-loader dependency

* refactor: updated postcss-loader dependency

* refactor(postcss-loader): added postcss dependency

* refactor: updated autoprefixer dependency

* refactor: updated copy-webpack-plugin dependency

* refactor: updated webpack dependency

* refactor: updated webpackbar dependency

* refactor: regenerated yarn.lock file

* refactor: regenerated yarn.lock file

* refactor(prettier): code rework on the prettier feedback

* refactor(prettier): code rework on the prettier feedback

* build: regenerated yarn.lock file

* refactor: updated webpack-cli dependency

* refactor: updated webpack dependency

* chore: removed unnecessary require entries

* build(webpack): 'stats' is the new 'display'

* build: regenerated package-lock.json file

* Revert "refactor: updated no-emit-webpack-plugin dependency"

* build: regenerated yarn.lock file

* chore: reverted node-sass-selector-importer update

* refactor: updated sass-loader dependency

* chore: code optimizations

that are mentioned by the github pipeline as well

* chore: rebuild yarn.lock file

* build: regenerated yarn.lock

* build: regenerated yarn.lock file

* refactor: updated clean-webpack-plugin

* refactor: updated copy-webpack-plugin

* refactor: updated html-webpack-plugin

* refactor: updated webpack

* refactor: updated webpack-cli

* refactor: updated webpack-dev-middleware

* refactor: updated webpack-hot-middleware

* refactor: updated webpack-merge

* refactor: updated webpackbar

* refactor: updated mini-css-extract-plugin

* refactor: updated babel-loader

* refactor: updating clean-css-loader

* refactor: updated css-loader

* refactor: updated postcss-loader

* refactor: updated sass-loader

* refactor: updated style-loader

* refactor: updated svg-sprite-loader

* refactor: updated svgo-loader

* refactor: updates ts-loader

* chore: updated html-loader

* refactor: minimize on productive build is the new default

https://github.com/webpack-contrib/html-loader/blob/master/CHANGELOG.md#100-2020-03-19

* refactor(webpack): we need to ignore those references

as those are generated independently and won't need to get followed by Webpack

* refactor(html-loader): interpolate option got removed

that for we need to adapt some other solution for the new preprocessor option

* fix(copy-webpack-plugin): correcting the path

to prevent webpack errors

* refactor: two of the options are now subitems of minimize

* chore: this attribute doesn't exist (any more)

* Restore packages/core/test/files/_handlebars-test-patterns/atoms/global/helloworld-withdata.hbs

* Restore packages/core/test/lineage_hunter_tests.js

* Restore packages/development-edition-engine-react/source/_meta/_head.html

* Restore packages/core/test/pattern_engines_tests.js

* Restore packages/core/test/pseudopattern_hunter_tests.js

* Restore packages/engine-handlebars/lib/engine_handlebars.js

* Restore packages/engine-nunjucks/lib/engine_nunjucks.js

* Restore packages/engine-twig-php/lib/engine_twig_php.js

* Restore packages/engine-underscore/_meta/_head.html

* Restore packages/engine-underscore/lib/engine_underscore.js

* Restore packages/uikit-workshop/src/scripts/actions/app.js

* chore: regenerated yarn.lock

* chore: corrected package.json

* fix: we need to import the cjs from handlebars directly

* Update webpack.config.js

* Update webpack.config.js

* Update webpack.config.js

* Update webpack.config.js

* chore: regenerated yarn.lock

* refactor: updated babel-loader dependency again

* refactor: updated clean-css-loader dependency again

* refactor: updated svgo-loader dependency again

---------

Co-authored-by: Maximilian <[email protected]>
Co-authored-by: Josef Bredreck <[email protected]>
whitphx added a commit to whitphx/streamlit that referenced this issue Feb 6, 2023
- Remove devServer.headers CRACO override because webpack-dev-server already sets this header with this version
- Move devServer.watchOptions CRACO override to webpack.watchOptions
- Add webpack.resolve.fallback CRACO override because Webpack5 does not inject polyfills automatically. Ref: https://webpack.js.org/configuration/resolve/#resolvefallback
- Remove hard-source-webpack-plugin because it is no longer needed with Webpack5. Ref: mzgoddard/hard-source-webpack-plugin#514 (comment)
antonia-rose pushed a commit to quelltexterin/nemo-uikit-workshop that referenced this issue Apr 12, 2023
…ion 5 & some cleanup (pattern-lab#1301)

* chore(docs): some typos

missed to replace mustache initially and incorrect handlebars two times (both in package name and URL)

* Revert "Merge pull request pattern-lab#2 from pattern-lab/dev"

This reverts commit 7812878, reversing
changes made to 26db979.

* Revert "Merge pull request pattern-lab#1 from pattern-lab/dev"

This reverts commit 26db979, reversing
changes made to fc90750.

* Revert "chore(docs): some typos"

This reverts commit 271dc8d.

* refactor: removed obsolete dependencies

Webpack 5 supportes module caching out of the box, compare to e.g. mzgoddard/hard-source-webpack-plugin#514 (comment)

* refactor: removed code out of obsolete dependency

* refactor: updated clean-css-loader related dependencies

* refactor: updated clean-webpack-plugin dependency

and restructured the code according to johnagan/clean-webpack-plugin#106

* refactor: updated webpack-merge dependency

* refactor: removed obsolete dependencies

this seems to have been removed (intentionally?) by pattern-lab@2cb663d#diff-8c9b7dba764c6bd34aaec36a6a42e7b69d9a46b19712a47706355bb8616d3319L365

* refactor: updated html-webpack-plugin dependency

* refactor: updated node-sass-magic-importer dependency

* refactor: updated style-loader dependency

* refactor: updated svg-sprite-loader dependency

* refactor: updated svg-transform-loader dependency

* refactor: updated svgo-loader dependency

* refactor: updated ts-loader dependency

* refactor: updated webpack-cli dependency

* refactor: updated copy-webpack-plugin dependency

* refactor: updated webpack-dev-middleware dependency

"the logger, logLevel and logTime options were removed without replacement." source: https://github.com/webpack/webpack-dev-middleware/releases?after=v4.0.0-rc.1

* refactor: updated mini-css-extract-plugin dependency

* refactor(webpackdevmiddleware): quiet has been removed a lot earlier even already

* refactor: updated no-emit-webpack-plugin dependency

* refactor: updated webpack dependency

* refactor: rebuild yarn.lock file

* refactor(terserplugin): options had an unknown property 'sourceMap'

* refactor(webpack): clean up configuration

https://webpack.js.org/migrate/5/#clean-up-configuration

* Revert "Merge branch 'dev' into refactor-updated-depencencies-webpack"

This reverts commit 8f347df, reversing
changes made to e619e63.

* refactor(webpack): updated outdated options

optimization.namedChunks: true → optimization.chunkIds: 'named'

source: https://webpack.js.org/migrate/5/#update-outdated-options

* refactor(webpack): updated outdated options

optimization.occurrenceOrder: true → optimization: { chunkIds: 'total-size', moduleIds: 'size' }

source: https://webpack.js.org/migrate/5/#update-outdated-options

* refactor: regenerated yarn.lock

* refactor: updated babel-loader dependency

* refactor: updated svg-sprite-loader dependency

* refactor: updated css-loader dependency

* refactor: updated postcss-loader dependency

* refactor(postcss-loader): added postcss dependency

* refactor: updated autoprefixer dependency

* refactor: updated copy-webpack-plugin dependency

* refactor: updated webpack dependency

* refactor: updated webpackbar dependency

* refactor: regenerated yarn.lock file

* refactor: regenerated yarn.lock file

* refactor(prettier): code rework on the prettier feedback

* refactor(prettier): code rework on the prettier feedback

* build: regenerated yarn.lock file

* refactor: updated webpack-cli dependency

* refactor: updated webpack dependency

* chore: removed unnecessary require entries

* build(webpack): 'stats' is the new 'display'

* build: regenerated package-lock.json file

* Revert "refactor: updated no-emit-webpack-plugin dependency"

* build: regenerated yarn.lock file

* chore: reverted node-sass-selector-importer update

* refactor: updated sass-loader dependency

* chore: code optimizations

that are mentioned by the github pipeline as well

* chore: rebuild yarn.lock file

* build: regenerated yarn.lock

* build: regenerated yarn.lock file

* refactor: updated clean-webpack-plugin

* refactor: updated copy-webpack-plugin

* refactor: updated html-webpack-plugin

* refactor: updated webpack

* refactor: updated webpack-cli

* refactor: updated webpack-dev-middleware

* refactor: updated webpack-hot-middleware

* refactor: updated webpack-merge

* refactor: updated webpackbar

* refactor: updated mini-css-extract-plugin

* refactor: updated babel-loader

* refactor: updating clean-css-loader

* refactor: updated css-loader

* refactor: updated postcss-loader

* refactor: updated sass-loader

* refactor: updated style-loader

* refactor: updated svg-sprite-loader

* refactor: updated svgo-loader

* refactor: updates ts-loader

* chore: updated html-loader

* refactor: minimize on productive build is the new default

https://github.com/webpack-contrib/html-loader/blob/master/CHANGELOG.md#100-2020-03-19

* refactor(webpack): we need to ignore those references

as those are generated independently and won't need to get followed by Webpack

* refactor(html-loader): interpolate option got removed

that for we need to adapt some other solution for the new preprocessor option

* fix(copy-webpack-plugin): correcting the path

to prevent webpack errors

* refactor: two of the options are now subitems of minimize

* chore: this attribute doesn't exist (any more)

* Restore packages/core/test/files/_handlebars-test-patterns/atoms/global/helloworld-withdata.hbs

* Restore packages/core/test/lineage_hunter_tests.js

* Restore packages/development-edition-engine-react/source/_meta/_head.html

* Restore packages/core/test/pattern_engines_tests.js

* Restore packages/core/test/pseudopattern_hunter_tests.js

* Restore packages/engine-handlebars/lib/engine_handlebars.js

* Restore packages/engine-nunjucks/lib/engine_nunjucks.js

* Restore packages/engine-twig-php/lib/engine_twig_php.js

* Restore packages/engine-underscore/_meta/_head.html

* Restore packages/engine-underscore/lib/engine_underscore.js

* Restore packages/uikit-workshop/src/scripts/actions/app.js

* chore: regenerated yarn.lock

* chore: corrected package.json

* fix: we need to import the cjs from handlebars directly

* Update webpack.config.js

* Update webpack.config.js

* Update webpack.config.js

* Update webpack.config.js

* chore: regenerated yarn.lock

* refactor: updated babel-loader dependency again

* refactor: updated clean-css-loader dependency again

* refactor: updated svgo-loader dependency again

---------

Co-authored-by: Maximilian <[email protected]>
Co-authored-by: Josef Bredreck <[email protected]>
@CaoKejian
Copy link

In webpack5, HardSourceWebpackPlugin can be replaced by cache

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

8 participants