esload
TypeScript icon, indicating that this package has built-in type declarations

0.0.0 • Public • Published

esload

Use webpack loaders as esbuild plugins

import {esload} from 'esload'
import {build} from 'esbuild'

const plugin = esload({
  name: 'my-plugin-name',
  // webpack loaders may emit files to this folder
  outdir: 'dist',
  // use these as you would use webpack module.rules
  rules: [
    {test: /\.txt$/, use: ['raw-loader']},
    {
      test: /\.scss$/,
      use: [
        'style-loader',
        {
          loader: 'css-loader',
          options: {modules: {auto: true}}
        },
        'sass-loader'
      ]
    },
    {test: /\.jpg$/, use: ['file-loader']}
    // ...
  ]
})

// build with esbuild
build({
  entryPoints: ['src/index.ts'],
  bundle: true,
  platform: 'node',
  outfile: 'dist/index.js',
  plugins: [plugin],
  define: {
    // some constants might have to be defined here
    __webpack_public_path__: '"/"'
  }
}).catch(() => process.exit(1))

Readme

Keywords

none

Package Sidebar

Install

npm i esload

Weekly Downloads

6

Version

0.0.0

License

MIT

Unpacked Size

121 kB

Total Files

23

Last publish

Collaborators

  • benmerckx