Add support for plugins

5
closed
Profesor08
Profesor08
Posted 8 months ago

Add support for plugins #207

Feature request

Will be great to have support for some custom plugins like esbuild-plugin-sass

Why?

To have posibility to use custom transformers

Alternatives

No response

Additional context

No response

privatenumber
privatenumber
Profesor08
Profesor08
Created 8 months ago

Why not just use Webpack sass-loader?

Because of that https://github.com/privatenumber/esbuild-loader#css-in-js, it supports only css. And I want to extend it some how.

privatenumber
privatenumber
Created 8 months ago

It supports SASS too. Just add it to the bottom of the chain so it can compile the SASS first, then esbuild can minify it, then give it to css-loader

  module.exports = {
    ...,

    module: {
      rules: [
        {
          test: /\.css$/i,
          use: [
            'style-loader',
            'css-loader',
+           {
+             loader: 'esbuild-loader',
+             options: {
+               loader: 'css',
+               minify: true
+             }
+           },
+           'sass-loader'
          ]
        }
      ]
    }
  }
Profesor08
Profesor08
Created 8 months ago

It supports SASS too. Just add it to the bottom of the chain so it can compile the SASS first, then esbuild can minify it, then give it to css-loader

Minification is useles in development process. But in production build it is handled by ESBuildMinifyPlugin

privatenumber
privatenumber
Created 8 months ago

Assuming you're asking if Sass can be used with ESBuildMinifyPlugin:

Sass works there too -- just add sass-loader without esbuild-loader like the snippet above.

LMK if you have any specific questions.