https://github.com/benmerckx/esload
Use webpack loaders as esbuild plugins
https://github.com/benmerckx/esload
esbuild webpack
Last synced: about 1 year ago
JSON representation
Use webpack loaders as esbuild plugins
- Host: GitHub
- URL: https://github.com/benmerckx/esload
- Owner: benmerckx
- Created: 2020-11-03T15:47:34.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-11-16T11:20:38.000Z (over 5 years ago)
- Last Synced: 2025-03-29T06:22:59.771Z (over 1 year ago)
- Topics: esbuild, webpack
- Language: TypeScript
- Homepage:
- Size: 126 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# esload
Use webpack loaders as esbuild plugins
```js
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))
```