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

feat: Upgrade to Webpack 5 #218

Merged
merged 15 commits into from
Aug 9, 2021

Conversation

loliver
Copy link
Contributor

@loliver loliver commented Mar 16, 2021

Working towards a fix for #215.

Our stack is React 17 with Treat, with our docs running on Gatsby.

The error I'm stuck on is getting pulled up in each imported component:

ERROR in ./node_modules/@oceanblue/textarea-field/dist/textarea-field.treat.js
Module build failed (from ./node_modules/treat/webpack-plugin/loader/dist/treat-webpack-plugin-loader.cjs.js):
TypeError: The 'compilation' argument must be an instance of Compilation
    at getCompilationHooks (/Users/username/Documents/Repos/ob-docs/node_modules/webpack/lib/javascript/JavascriptModulesPlugin.js:112:10)
    at /Users/username/Documents/Repos/ob-docs/node_modules/webpack/lib/javascript/CommonJsChunkFormatPlugin.js:40:19
    at Hook.eval [as call] (eval at create (/Users/username/Documents/Repos/ob-docs/node_modules/loliver-test-playroom/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
    at Hook.CALL_DELEGATE [as _call] (/Users/username/Documents/Repos/ob-docs/node_modules/loliver-test-playroom/node_modules/webpack/node_modules/tapable/lib/Hook.js:14:14)
    at Compiler.newCompilation (/Users/username/Documents/Repos/ob-docs/node_modules/loliver-test-playroom/node_modules/webpack/lib/Compiler.js:1014:30)
    at /Users/username/Documents/Repos/ob-docs/node_modules/loliver-test-playroom/node_modules/webpack/lib/Compiler.js:1057:29
    at Hook.eval [as callAsync] (eval at create (/Users/username/Documents/Repos/ob-docs/node_modules/loliver-test-playroom/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/username/Documents/Repos/ob-docs/node_modules/loliver-test-playroom/node_modules/webpack/node_modules/tapable/lib/Hook.js:18:14)
    at Compiler.compile (/Users/username/Documents/Repos/ob-docs/node_modules/loliver-test-playroom/node_modules/webpack/lib/Compiler.js:1052:28)
    at Compiler.runAsChild (/Users/username/Documents/Repos/ob-docs/node_modules/loliver-test-playroom/node_modules/webpack/lib/Compiler.js:518:8)
    at /Users/username/Documents/Repos/ob-docs/node_modules/treat/webpack-plugin/dist/treat-webpack-plugin.cjs.dev.js:343:21
    at Promise._execute (/Users/username/Documents/Repos/ob-docs/node_modules/bluebird/js/release/debuggability.js:384:9)
    at Promise._resolveFromExecutor (/Users/username/Documents/Repos/ob-docs/node_modules/bluebird/js/release/promise.js:518:18)
    at new Promise (/Users/username/Documents/Repos/ob-docs/node_modules/bluebird/js/release/promise.js:103:10)
    at compileTreatSource (/Users/username/Documents/Repos/ob-docs/node_modules/treat/webpack-plugin/dist/treat-webpack-plugin.cjs.dev.js:315:10)
    at getSource (/Users/username/Documents/Repos/ob-docs/node_modules/treat/webpack-plugin/dist/treat-webpack-plugin.cjs.dev.js:272:37)
 @ ./node_modules/@oceanblue/textarea-field/dist/index.js 69:29-62
 @ ./playroom/thematic/components.ts 20:17-75
 @ ./node_modules/loliver-test-playroom/src/components.js 2:0-58
 @ ./node_modules/loliver-test-playroom/src/frame.js 12:48-71 26:2-30:4 28:18-41 26:36-30:3

As well as the following which I'm pretty sure are just based on the Webpack builds failing per compnent:

ERROR in frame
Module not found: Error: Can't resolve 'webpack-dev-server/client?http://localhost:9000' in '/Users/username/Documents/Repos/ob-docs'

ERROR in index
Module not found: Error: Can't resolve 'webpack-dev-server/client?http://localhost:9000' in '/Users/username/Documents/Repos/ob-docs'

ERROR in preview
Module not found: Error: Can't resolve 'webpack-dev-server/client?http://localhost:9000' in '/Users/username/Documents/Repos/ob-docs'

Have published a smurf package to loliver-test-playroom as I was getting issues with multiple Webpack installs.

Hoping there are others out there that this can help and we can get to a solution.

Cheers.

loliver and others added 2 commits March 17, 2021 12:19
@loliver loliver marked this pull request as ready for review April 14, 2021 13:23
@loliver loliver requested a review from a team as a code owner April 14, 2021 13:23
@loliver
Copy link
Contributor Author

loliver commented Apr 14, 2021

Had some time tonight to dig in to the Cypress test failures, base64-url is still expecting Buffer from node to exist by default so I've added a plugin that polyfills Webpack 5 as per the older versions.

Getting an error of not having the plugin installed in a consuming app so have moved node-polyfill-webpack-plugin to regular dependencies.
@belaczek
Copy link

Can somebody from maintainers please take a look at this PR?
@markdalgleish @michaeltaranto @mattcompiles

@mattcompiles
Copy link
Contributor

Hey 👋,

Sorry we haven't had bandwidth to look into this. Our main concern here is maintaining compatibility with webpack 4 as a lot of consumers are still using it. Not sure how difficult it would be to support both but otherwise we'll need to do a breaking change.

Also there are a lot of changes in this PR that seem unrelated to webpack 5 which makes it a bit hard to review.

@mattcompiles mattcompiles changed the title Upgrade to Webpack 5 feat: Upgrade to Webpack 5 Aug 9, 2021
@mattcompiles mattcompiles merged commit ce918e1 into seek-oss:master Aug 9, 2021
@loliver loliver deleted the upgrade-to-webpack-5 branch August 9, 2021 23:10
@loliver
Copy link
Contributor Author

loliver commented Aug 9, 2021

Thanks all! 🎉

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

Successfully merging this pull request may close these issues.

None yet

4 participants