2023-07-28 08:29:53 -04:00
|
|
|
# rollup-build-webext-config
|
|
|
|
|
|
|
|
Simplify Rollup configuration for browser extensions by pulling script entry
|
|
|
|
points and other asset paths straight from your `manifest.json`. Recognizes
|
|
|
|
manifest versions 2 and 3.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
### Targeting a single platform
|
|
|
|
|
|
|
|
```js
|
|
|
|
// rollup.config.js
|
|
|
|
import {buildConfig} from 'rollup-build-webext-config';
|
|
|
|
|
|
|
|
import commonjs from '@rollup/plugin-commonjs';
|
|
|
|
import {nodeResolve} from '@rollup/plugin-node-resolve';
|
|
|
|
|
|
|
|
export default buildConfig({
|
|
|
|
manifest: 'path/to/your/manifest.json',
|
|
|
|
outDir: 'build',
|
|
|
|
sourcemap: 'inline',
|
|
|
|
plugins: [
|
|
|
|
nodeResolve(),
|
|
|
|
commonjs(),
|
|
|
|
],
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
### Targeting multiple platforms
|
|
|
|
|
|
|
|
```js
|
|
|
|
// rollup.config.js
|
|
|
|
import {buildConfig} from 'rollup-build-webext-config';
|
|
|
|
|
|
|
|
export default ['chromium', 'firefox'].flatMap(platform =>
|
|
|
|
buildConfig({
|
|
|
|
manifest: `manifest-${platform}.json`,
|
|
|
|
outDir: `build/${platform}`,
|
|
|
|
// ...
|
|
|
|
})
|
|
|
|
);
|
2023-08-14 14:07:31 -04:00
|
|
|
```
|