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

Webpack3 (no es6 changes) #4800

Closed
wants to merge 12 commits into from
Closed

Webpack3 (no es6 changes) #4800

wants to merge 12 commits into from

Conversation

MTRNord
Copy link
Contributor

@MTRNord MTRNord commented Aug 15, 2017

This is optional PR which updates webpack to v3.x.x.

bundle.js size gets down to 8.4MB from about 9.0MB before and bundle.css changes from 3.3Kb to 12Kb.
(I personally think also it is slightly faster when building. Not saw any changes on the webpage in speed)

@eqyiel
Copy link

eqyiel commented Dec 4, 2017

Is this still considered optional given that Webpack 1x's life support was switched off in April?

@MTRNord
Copy link
Contributor Author

MTRNord commented Dec 5, 2017

It says optional as I am not member of the riot Team :) I am just not in the Position to decide

@dbkr dbkr removed their assignment Dec 7, 2017
@t3chguy
Copy link
Member

t3chguy commented Dec 18, 2017

/me wonders why no one wants to review this :P

@pafcu
Copy link
Contributor

pafcu commented Dec 21, 2017

I think this might solve real issues: https://matrix.to/#/!DdJkzRliezrwpNebLk:matrix.org/%2415137819892616558FrkqI:matrix.org

Any chance of getting this merged?

@MTRNord
Copy link
Contributor Author

MTRNord commented Jan 26, 2018

Friendly bump😇

@MTRNord
Copy link
Contributor Author

MTRNord commented Apr 9, 2018

It might make sense to use the cacheDirectory option of babel-loader to speed up the build. Any opinions on this?

Copy link
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

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

So the context on this is that we'd been reluctant to introduce changes to the platform while we were trying to get things stable. Now 0.14 is, it's a better time to be looking at making changes like this.

I haven't actually tried to run this yet, but have commented on the two things I don't understand.

@@ -32,4 +32,4 @@ addons:
install:
# clone the deps with depth 1: we know we will only ever need that one
# commit.
- scripts/fetch-develop.deps.sh --depth 1 && npm install
- npm install && scripts/fetch-develop.deps.sh --depth 1
Copy link
Member

Choose a reason for hiding this comment

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

I vaguely remember asking you about this back when you submitted the PR... if I did, I can't remember the conclusion though. Why is this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it was the CI being stupid. It works this way not the other way. But I have to admit I do not know if this still is required

Copy link
Contributor Author

@MTRNord MTRNord Apr 20, 2018

Choose a reason for hiding this comment

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

It was propably the symlink issue that npm has which later got finished

htmlWebpackPlugin.files.js.splice(i, 1);
}
}
for (var i=0; i < htmlWebpackPlugin.files.js.length; i++) {
Copy link
Member

Choose a reason for hiding this comment

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

  1. You're putting olm first? Why?
  2. The array variable is unused.
  3. Indents.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. Because in webpack 3 they get randomly ordered which causes olm to sometimes not load. The old script relied on the case that the array is always ordered the same way.

2 and 3 can I fix after the weekend

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dbkr I am not sure about 3. Should I do 2 spaces or 4? the html uses 2 spaces. Or do you mean the if that is missing one space?

Copy link
Member

Choose a reason for hiding this comment

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

ah ok. Yeah, I can see how that would break. Generally all the indents should be 4 spaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess I will leave the html as is but fix the Js code in there

Copy link
Member

Choose a reason for hiding this comment

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

Also, I wonder if we should be using chunksSortMode for the ordering (although given the docs don't tell you anything about what the different modes do, perhaps your solution is better...)

@dbkr
Copy link
Member

dbkr commented Apr 20, 2018

Just tried this and it looks like it's failing to run the postcss preprocessor?

ERROR in ./res/themes/status/css/status.scss
Module parse failed: /Users/dave/matrix/riot-web/res/themes/status/css/status.scss Unexpected character '@' (1:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character '@' (1:0)
    at Parser.pp$4.raise (/Users/dave/matrix/riot-web/node_modules/webpack/node_modules/acorn/dist/acorn.js:2221:15)
    at Parser.pp$7.getTokenFromCode (/Users/dave/matrix/riot-web/node_modules/webpack/node_modules/acorn/dist/acorn.js:2756:10)
    at Parser.pp$7.readToken (/Users/dave/matrix/riot-web/node_modules/webpack/node_modules/acorn/dist/acorn.js:2477:17)
    at Parser.pp$7.nextToken (/Users/dave/matrix/riot-web/node_modules/webpack/node_modules/acorn/dist/acorn.js:2468:15)
    at Parser.parse (/Users/dave/matrix/riot-web/node_modules/webpack/node_modules/acorn/dist/acorn.js:515:10)
    at Object.parse (/Users/dave/matrix/riot-web/node_modules/webpack/node_modules/acorn/dist/acorn.js:3098:39)
    at Parser.parse (/Users/dave/matrix/riot-web/node_modules/webpack/lib/Parser.js:902:15)
    at NormalModule.<anonymous> (/Users/dave/matrix/riot-web/node_modules/webpack/lib/NormalModule.js:104:16)
    at NormalModule.onModuleBuild (/Users/dave/matrix/riot-web/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10)
    at nextLoader (/Users/dave/matrix/riot-web/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25)
    at /Users/dave/matrix/riot-web/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5
    at Storage.finished (/Users/dave/matrix/riot-web/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16)
    at /Users/dave/matrix/riot-web/node_modules/graceful-fs/graceful-fs.js:78:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)

@MTRNord
Copy link
Contributor Author

MTRNord commented Apr 20, 2018

Hmm maybe some things got too old. I will after the weekend (I am on a Event and not at a PC) test this again and Do the needed changes

@MTRNord
Copy link
Contributor Author

MTRNord commented Apr 20, 2018

actually taking a quick google it seems it is a url-loader/css-loader aka webpack bug webpack-contrib/css-loader#355

@MTRNord
Copy link
Contributor Author

MTRNord commented Apr 20, 2018

The other option I see is that the config format has changed for postcss

@MTRNord
Copy link
Contributor Author

MTRNord commented Apr 20, 2018

@dbkr I updated the postcss to the newest version. Lets see if that helps. If you want you can test it. The CI seems to still work as before

@MTRNord
Copy link
Contributor Author

MTRNord commented Apr 26, 2018

/me now does some testing and will maybe tommorow make a webpack 4 PR for the future ^^ but seperate from this one to have a clean pr

@MTRNord
Copy link
Contributor Author

MTRNord commented Apr 26, 2018

ok I will test tommorrow. Setting up a fresh dev space after 600missing commits takes a lot of time. Installing deps takes on my hdd 1h. So I will have some commits to this tommorow propably

@MTRNord
Copy link
Contributor Author

MTRNord commented Apr 26, 2018

@dbkr the last commit should have fixed your error now. The reason was you have scss inside a node_modules folder and I excluded that to speed up the build. I now included only the needed folders from node_modules to fix the failing to load and at the same time not to need to include the hole node_modules

@MTRNord
Copy link
Contributor Author

MTRNord commented Apr 26, 2018

Tested it and it works for me.

@MTRNord
Copy link
Contributor Author

MTRNord commented Apr 26, 2018

Some sizes for thoose who like to know them:

bundle.css: 11,67KB
theme-status.css: 221,47KB
theme-light.css: 211,90KB
theme-dark.css: 213,02KB
olm.js: 451,56KB
bundle.js: 10,50MB
theme-status.js: 2,82KB
theme-light.js: 2,82KB
theme-dark.js: 2,82KB

@MTRNord
Copy link
Contributor Author

MTRNord commented Apr 27, 2018

#6620 tracks an update to webpack4

@MTRNord MTRNord closed this Oct 16, 2018
@MTRNord MTRNord deleted the webpack3_noES6 branch October 16, 2018 14:20
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

5 participants