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

Meta: Update dependencies and simplify build #3639

Merged
merged 12 commits into from Oct 14, 2020
Merged

Meta: Update dependencies and simplify build #3639

merged 12 commits into from Oct 14, 2020

Conversation

fregante
Copy link
Member

@fregante fregante commented Oct 11, 2020

  • Update Webpack to v5 (+ loaders)
  • Replace ts-loader with esbuild-loader to save a couple of seconds of build time
  • Keep static files to ./distribution instead of using Webpack to copy them (reduces config)
  • Drop old unused dependencies
  • Lint DefinePlugin

Overall, the config file is 46 lines shorter (-27%) 🍰

Next, maybe:

  • Update dependencies again later to avoid some deprecation notices
  • Find out why it still takes 11 seconds to build. Edit: it appears to wait idly for a few seconds for no reason:

👆 made with https://webpack.js.org/plugins/profiling-plugin/

@fregante fregante added the meta Related to Refined GitHub itself label Oct 11, 2020
// Automatically enabled on production;
// Keeps it somewhat readable for AMO reviewers
minimizer: [
new TerserPlugin({
Copy link
Member Author

Choose a reason for hiding this comment

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

I dropped all of this because AMO doesn't seem to mind minified code. Also the .map files are still included.

Comment on lines -113 to -120
from: 'source',
globOptions: {
ignore: [
'**/*.js',
'**/*.ts',
'**/*.tsx',
'**/*.css'
]
Copy link
Member Author

Choose a reason for hiding this comment

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

I dropped this configuration in lieu of just keeping 3 (THREE!) static files in the distribution folder.

I was hoping to drop CopyWebpackPlugin completely but apparently import 'webextension-polyfill' doesn't work with Webpack, it won't be a global. With Parcel it works.

},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
Copy link
Member Author

Choose a reason for hiding this comment

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

tsc alternatives include swc and sucrase. esbuild is the fastest one according to https://twitter.com/youyuxi/status/1257661327180361730

I checked the output and it's the same, except the transpilation of ?. and ...

esbuild also includes a fast minifier, but the output is not as minified as Terser’s, so it's not worth replacing it.

@fregante fregante marked this pull request as ready for review October 11, 2020 03:38
@yakov116
Copy link
Member

🎉

@yakov116
Copy link
Member

Is this TODO fixable?

https://github.com/sindresorhus/refined-github/blob/a121cc8b54c1fa984659f6a0e61f1e0ea89ff348/tsconfig.json#L4

@fregante
Copy link
Member Author

Is this TODO fixable?

Indeed. This also saves a lot of bytes 😛

           options.js ⏤  30.9 kB (-21 B)
    refined-github.js ⏤  98.9 kB (-648 B)

@yakov116
Copy link
Member

The build size should be much smaller now

@yakov116
Copy link
Member

yakov116 commented Oct 12, 2020

https://github.com/fregante/delegate-it/releases/tag/v2.0.1 or is this not part of this pr?

@fregante
Copy link
Member Author

fregante commented Oct 13, 2020

is this not part of this pr

It's unrelated to the build, it can be done separately. Not urgent either 😄

@fregante fregante changed the title Meta: Update build and simplify it Meta: Update dependencies and simplify build Oct 14, 2020
@fregante fregante merged commit dd60ee1 into master Oct 14, 2020
@fregante fregante deleted the webpack-5 branch October 14, 2020 04:13
@yakov116
Copy link
Member

Resolve conflicts stopped working
https://github.com/sindresorhus/refined-github/pull/3596/conflicts

@fregante
Copy link
Member Author

Heh, I thought about testing it and then forgot while I was looking for conflicts. Fixed in the latest commit

@yakov116
Copy link
Member

[webpack-cli] SyntaxError: Unexpected token '.'

I am unable to build 😢 not sure whats wrong!

@fregante
Copy link
Member Author

GitHub Actions passed. Npm install and use node 14

@yakov116
Copy link
Member

use node 14

That worked thanks

@yakov116 yakov116 mentioned this pull request Oct 23, 2020
fregante added a commit that referenced this pull request Nov 1, 2020
fregante added a commit that referenced this pull request Nov 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta Related to Refined GitHub itself
Development

Successfully merging this pull request may close these issues.

None yet

2 participants