mirror of
https://github.com/MercuryWorkshop/adrift.git
synced 2025-05-12 13:50:01 -04:00
add dynamic
This commit is contained in:
parent
ebe1f18b68
commit
f5e0c4202e
20 changed files with 1782 additions and 252 deletions
|
@ -2,7 +2,7 @@ import { build } from 'esbuild';
|
|||
import inlineImportPlugin from 'esbuild-plugin-inline-import';
|
||||
import path from "path";
|
||||
import fs from "fs/promises";
|
||||
|
||||
import _fs from "fs";
|
||||
const transform = options => {
|
||||
const { filter, namespace, transform } = Object.assign(
|
||||
{
|
||||
|
@ -19,6 +19,8 @@ const transform = options => {
|
|||
return {
|
||||
name: 'esbuild-sw-transformer',
|
||||
setup(build) {
|
||||
if (_fs.existsSync("./sw.js"))
|
||||
fs.rm("./sw.js");
|
||||
build.onResolve({ filter }, args => {
|
||||
const realPath = args.path.replace(filter, '');
|
||||
return {
|
||||
|
@ -64,8 +66,9 @@ const transform = options => {
|
|||
}
|
||||
};
|
||||
};
|
||||
|
||||
build({
|
||||
entryPoints: ['../sw.js'],
|
||||
entryPoints: ['../public/sw.js'],
|
||||
bundle: true,
|
||||
outfile: 'sw.js',
|
||||
plugins: [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue