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

[VsCoq1] Webpack Client and Server #266

Closed
wants to merge 1 commit into from
Closed

Conversation

fakusb
Copy link

@fakusb fakusb commented Dec 25, 2021

The client and server are now webpacked. To make this all work out, I had to split the single 'out' folder into three out folders, next to the already existing three src folders. Also, now a few more files are ignored when bundling the extension as .vsix file for publishing in the marketplaces (.vscodeignore). And I could remove a dependency on copy-webpack-plugin, which more than halved the number of npm-packages we depend on.

The debugging of the extension itself works as before, including breakpoints and sourcemaps.

The extension now loads ~20% faster (from a startup time of 100 ms to 80ms), and is smaller (312kB .vsix file instead of >5MB), and consists of a lot less files (The warning upon packaging the vsix file is now gone, so the nudging from microsoft to webpack worked for me).

And when we want to support vscode-server, webpacking will be needed (so this is towards #257 ).

This superseeds #69.

Copy link

@artagnon artagnon left a comment

Choose a reason for hiding this comment

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

Nice overall. Should have minimal conflicts with #276.

node_modules/.bin/vsce package

clean:
rm -rf node_modules out
rm -rf node_modules client/out server/out html_views/out

Choose a reason for hiding this comment

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

This line can be replaced by a terse git clean -dfx, if the .gitignore is correct.

Comment on lines +809 to +815
"package": "webpack --mode production --config webpack.config.js",
"package:dev": "webpack --mode development --config webpack.config.js",
"compile": "webpack --mode none --config webpack.config.js",
"compile:client": "webpack --mode none --config webpack.client.config.js",
"compile:html_views": "webpack --mode none --config ./webpack.html_views.config.js",
"compile:server": "webpack --mode none --config ./webpack.server.config.js",
"watch": "webpack --watch --mode none --config webpack.config.js",

Choose a reason for hiding this comment

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

I would drop "compile:server", "compile:client", and "compile:html_views", as webpack is smart enough to compile only what's necessary: a webpack invoked from the toplevel directory should do whatever is necessary, and it's unlikely that any developer would invoke any of these three build targets individually.

Further, --config webpack.config.js can be stripped, as webpack automatically looks for a webpack.config.js by default. Perhaps add --devtool hidden-source-map to "package", and drop the extraneous --mode none, as the common config specifies this mode.

Finally, I might be tempted to drop the "package:dev" target, as it's unlikely to be used directly.

"compile:html_views": "webpack --mode none --config ./webpack.html_views.config.js",
"compile:server": "webpack --mode none --config ./webpack.server.config.js",
"watch": "webpack --watch --mode none --config webpack.config.js",
"clean": "rimraf client/out && rimraf html_views/out && rimraf server/out"

Choose a reason for hiding this comment

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

This is duplicating code from the Makefile and unnecessarily adding a dependency.

Comment on lines +6 to +7
//"outDir": "out",
//"rootDir": "src",

Choose a reason for hiding this comment

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

Please strip these commented out lines.

Comment on lines +4 to +5
"module": "commonjs",
"target": "es6",

Choose a reason for hiding this comment

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

Consider factoring out these two lines into tsconfig.base.json.

Comment on lines +9 to +10
"lib": ["es6", "dom"],
"sourceMap": true,

Choose a reason for hiding this comment

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

Consider factoring out these two lines too.

"module": "commonjs",
"target": "es6",
"outDir": "out",
"tsBuildInfoFile": "out/tsconfig.tsBuildInfoFile",

Choose a reason for hiding this comment

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

Very nice!

Comment on lines +17 to +19
//node: {
// __dirname: false // leave the __dirname-behaviour intact
//},

Choose a reason for hiding this comment

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

Please remove this dead code.

@maximedenes maximedenes changed the title Webpack Client and Server [VsCoq1] Webpack Client and Server Feb 14, 2023
@thery
Copy link
Contributor

thery commented Feb 19, 2023

@fakusb @Blaisorblade @huynhtrankhanh @4ever2. I'd like to include this to the next release. This is far beyond my competence, 😞 . Any ideas how to rebase this?

@4ever2
Copy link
Contributor

4ever2 commented Feb 19, 2023

@thery I rebased this and it seems to work okay after a few minor fixes. But still need to test it more.

https://github.com/4ever2/vscoq/tree/webpack

@thery
Copy link
Contributor

thery commented Feb 19, 2023

@4ever2 Thanks a lot. I think it is worth being merged. I will test it.

@thery
Copy link
Contributor

thery commented Mar 1, 2023

This is superseded by #411

@thery thery closed this Mar 1, 2023
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.

4 participants