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

[WIP] Webpack@5 #46

Closed
wants to merge 14 commits into from
Closed

[WIP] Webpack@5 #46

wants to merge 14 commits into from

Conversation

matheus1lva
Copy link
Collaborator

@matheus1lva matheus1lva commented Jan 4, 2019

per #43 .

I reworked some files, moved some dependencies to the top level and updated some. Server still having issues to start due to what was already reported on #42.

It is a WIP, i still need to find a better way to clean cache when we change any webpack config. I'm gonna read the changelog and see what they suggest.

Otherwise, it's pretty complete i guess.

ps: some plugins/loaders on web package i had to comment it out, they are not ready to be moved to webpack5 yet (yeah, more breaking changes).

The following plugins are broken:
mini-css-extract-plugin
html-webpack-plugin

@sibelius
Copy link
Member

sibelius commented Jan 4, 2019

lint and test are failing

can you check?

can you also list any issues of loaders to support webpack 5?

good job

@sibelius
Copy link
Member

sibelius commented Jan 4, 2019

is it faster on first build?
is it faster on rebuild?
is it faster on HMR?

package.json Outdated Show resolved Hide resolved
packages/web/src/App.tsx Outdated Show resolved Hide resolved
@matheus1lva matheus1lva self-assigned this Jan 5, 2019
@matheus1lva matheus1lva added the enhancement New feature or request label Jan 5, 2019
@matheus1lva
Copy link
Collaborator Author

matheus1lva commented Jan 5, 2019

Tests are failing trying to load a .env file that probably is not being created when tests run (it is not created locally). How to proceed?
Everything else is fixed.

Now apparently webpack build stopped working and i have no idea why. I'm looking at it and also i'm still looking at those plugins that need to be updated.

@sibelius
Copy link
Member

sibelius commented Jan 5, 2019

the first run was 2000ms
the next run was 500ms

I nice improvement over the cache

I've got this problem https://github.com/shellscape/webpack-plugin-serve/blob/master/.github/FAQ.md#what-does-the-not-found--404-error-mean

maybe it is related to html-webpack-plugin

we can remove mini css, as we use styled-components, no need for directly css

@sibelius
Copy link
Member

sibelius commented Jan 5, 2019

wps hmr client file is not being generated as well

@sibelius
Copy link
Member

sibelius commented Jan 5, 2019

it is also not generating .cache directory

@sibelius
Copy link
Member

sibelius commented Jan 5, 2019

Migrating html-webpack-plugin to 4 beta5 solves the problem with it

but it throws another error

Uncaught ReferenceError: global is not defined
    at eval (index.js?e792:25)
    at Object../node_modules/@babel/polyfill/lib/index.js (bundle.js:3822)
    at __webpack_require__ (bundle.js:24)
    at fn (bundle.js:4146)
    at eval (index.tsx:2)
    at Module../src/index.tsx (bundle.js:3951)
    at __webpack_require__ (bundle.js:24)
    at startup (bundle.js:46)
    at bundle.js:53
    at bundle.js:56

@sibelius
Copy link
Member

sibelius commented Jan 5, 2019

maybe related to webpack/webpack#8537 (comment)

@matheus1lva
Copy link
Collaborator Author

Interesting that it changed... I'm going to investigate if the behavior I was getting yesterday continues even with the beta version. Because not even with a python server the bundle was being executed (on web)

@matheus1lva
Copy link
Collaborator Author

maybe related to webpack/webpack#8537 (comment)

Yeah, apparently it is related. They moved the builtins to a runtime plugin, which apparently isn't working properly anymore... i'm going to track that down

@matheus1lva
Copy link
Collaborator Author

matheus1lva commented Jan 5, 2019

On normal builds, without a dev-server, it went from: 4s on first build to 2s on next builds.
Cache is being put on a .cache folder inside web/webpack and server/webpack

@matheus1lva
Copy link
Collaborator Author

matheus1lva commented Jan 7, 2019

Migrating html-webpack-plugin to 4 beta5 solves the problem with it

but it throws another error

Uncaught ReferenceError: global is not defined
    at eval (index.js?e792:25)
    at Object../node_modules/@babel/polyfill/lib/index.js (bundle.js:3822)
    at __webpack_require__ (bundle.js:24)
    at fn (bundle.js:4146)
    at eval (index.tsx:2)
    at Module../src/index.tsx (bundle.js:3951)
    at __webpack_require__ (bundle.js:24)
    at startup (bundle.js:46)
    at bundle.js:53
    at bundle.js:56

Fixed, but html-webpack-plugin still throwing errors due to incompatibility as we already expected (even with the beta version), this only happens after a successful build when you save a file.

@entria/web: TypeError: Cannot read property 'get' of undefined
@entria/web:     at childCompiler.fileDependencies.some (/home/matheus/projects/forks/entria-fullstack/node_modules/html-webpack-plugin/lib/compiler.js:341:38)
@entria/web:     at Array.some (<anonymous>)
@entria/web:     at isChildCompilerCacheOutdated (/home/matheus/projects/forks/entria-fullstack/node_modules/html-webpack-plugin/lib/compiler.js:340:59)
@entria/web:     at Object.hasOutDatedTemplateCache (/home/matheus/projects/forks/entria-fullstack/node_modules/html-webpack-plugin/lib/compiler.js:321:16)
@entria/web:     at compiler.hooks.thisCompilation.tap (/home/matheus/projects/forks/entria-fullstack/node_modules/html-webpack-plugin/index.js:132:25)
@entria/web:     at SyncHook.eval [as call] (eval at create (/home/matheus/projects/forks/entria-fullstack/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
@entria/web:     at Compiler.newCompilation (/home/matheus/projects/forks/entria-fullstack/node_modules/webpack/lib/Compiler.js:526:30)
@entria/web:     at hooks.beforeCompile.callAsync.err (/home/matheus/projects/forks/entria-fullstack/node_modules/webpack/lib/Compiler.js:567:29)
@entria/web:     at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/matheus/projects/forks/entria-fullstack/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
@entria/web:     at Compiler.compile (/home/matheus/projects/forks/entria-fullstack/node_modules/webpack/lib/Compiler.js:562:28)

Feedback left here: jantimon/html-webpack-plugin#1129

@sibelius
Copy link
Member

not ready yet

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@a78e9b7). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #46   +/-   ##
=========================================
  Coverage          ?   82.23%           
=========================================
  Files             ?       21           
  Lines             ?      197           
  Branches          ?       35           
=========================================
  Hits              ?      162           
  Misses            ?       27           
  Partials          ?        8
Impacted Files Coverage Δ
packages/web/jest.setup.js 100% <100%> (ø)
packages/web/src/App.tsx 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a78e9b7...0923b81. Read the comment docs.

"@types/react-relay": "1.3.10",
"@types/rebass": "0.3.4",
"@types/styled-components": "4.1.6",
"@types/styled-system": "3.1.3",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can move all @types to root package

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if types are not "common"?

Copy link
Member

@sibelius sibelius Jan 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let them here then

@matheus1lva matheus1lva mentioned this pull request Jan 29, 2019
@sibelius
Copy link
Member

sibelius commented Oct 2, 2020

we can try again next week, tks

@sibelius sibelius closed this Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants