You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just a feature suggestion. Instead of dropping babel-loader, it can be used together with esbuild-loader:
// define esbuild-loaderconstesbuildLoader={// These could be used for the patched babel-loader// test: /\.(js|mjs|jsx|ts|tsx)$/,// include: [paths.appSrc, ...optionalIncludes],loader: require.resolve('esbuild-loader'),options: esbuildLoaderOptions
? esbuildLoaderOptions
: {loader: useTypeScript ? 'tsx' : 'jsx',target: 'es2015',},};// modify babel loaderconstbabelLoaderPrev=getLoader(webpackConfig,loaderByName('babel-loader')).match.loader;const{ loader, options }=babelLoaderPrev;constbabelLoader={ loader, options };// Only keep styled-components plugin, drop the restoptions.presets=[];options.plugins=['babel-plugin-styled-components'];constbabelEsbuildLoader=babelLoaderPrev;// Switch to .usedeletebabelEsbuildLoader.loader;deletebabelEsbuildLoader.options;babelEsbuildLoader.use=[babelLoader,esbuildLoader];
Not sure how the api should look like, just added my own configuration to include styled-components plugin. It seems to work fine after esbuild has done all the heavy work.
I never said I'm not using babel-loader. It's in the example above. I use esbuild-loader in chain with babel-loader. You cannot use babel plugins with esbuild. They are babel plugins, not esbuild plugins.
The idea was share the tasks. TS transpiling is done using esbuild and some additions (styled-components) with babel. Babel can read the output of esbuild so we can do some light things there.
Just a feature suggestion. Instead of dropping babel-loader, it can be used together with esbuild-loader:
Not sure how the api should look like, just added my own configuration to include styled-components plugin. It seems to work fine after esbuild has done all the heavy work.
Inspiration: https://news.ycombinator.com/item?id=26977799
The text was updated successfully, but these errors were encountered: