Use esbuild to speed up bundling #31
Replies: 2 comments 6 replies
-
ESBuild has been certainly on my radar - very exciting tech! I do wonder about type checking though - as far as I know esbuild strips types & doesn't do any type checking - that's left for |
Beta Was this translation helpful? Give feedback.
-
@7ammer Do you have an example repository to do this? I would like to test it or if possible even keep it as default in my projects. config.module
.rule('ts')
.test(/\.ts?$/)
.use('esbuild-loader')
.loader(require.resolve('esbuild-loader'))
.options({
loader: 'ts',
target: 'es2017',
tsconfigRaw: require('./tsconfig.json')
}); Could you make a flag in nativescript.config.ts to choose one or the other? This starting speed would be very very interesting. |
Beta Was this translation helpful? Give feedback.
-
I've noticed a lot of buzz around esbuild and I was wondering if nativescript could utilise this.
I found a webpack plugin that could possibly replace 'ts-loader' and 'babel-loader' called esbuild-loader.
I've run some very quick tests on an existing Vue project:
ts-loader
ns run android --no-hmr
took ~1min to startup. 😴Reloads took ~5s
esbuild-loader
ns run android --no-hmr
took ~15sec to startup. ⚡️Reloads took ~3s
My un-minified bundle.js size is about < 2MiB
I've not tested hmr but I expect that to be faster too.
It also has a minifying option which is also fast but I've not tried it.
As an added bonus it also fixed my VUE HMR issues where editing .vue files didn't update the app. No idea why.
See the esbuild-loader readme on how to set it up.
Beta Was this translation helpful? Give feedback.
All reactions