Compare commits
No commits in common. "fb9b0a9c03ed0c81a81d58baa742ed55b60f23c7" and "178f9e72a74deb155d7aca093317d5bf652e5c81" have entirely different histories.
fb9b0a9c03
...
178f9e72a7
1 changed files with 1 additions and 7 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import { readFile } from 'node:fs/promises'
|
||||
import { dirname, resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import * as esbuild from 'esbuild'
|
||||
import { build } from 'vite'
|
||||
|
||||
import {
|
||||
|
|
@ -23,10 +22,6 @@ const getProdSwEnv = ({ assets }) =>
|
|||
|
||||
export const devSwPlugin = ({ swSrc, swDest, transformSW, alias }) => {
|
||||
const swFullSrc = resolve(projectRoot, swSrc)
|
||||
const esbuildAlias = {}
|
||||
Object.entries(alias).forEach(([source, dest]) => {
|
||||
esbuildAlias[source] = dest.startsWith('/') ? projectRoot + dest : dest
|
||||
})
|
||||
|
||||
return {
|
||||
name: 'dev-sw-plugin',
|
||||
|
|
@ -58,12 +53,11 @@ export const devSwPlugin = ({ swSrc, swDest, transformSW, alias }) => {
|
|||
*/
|
||||
async transform(code, id) {
|
||||
if (id === swFullSrc && transformSW) {
|
||||
const res = await esbuild.build({
|
||||
const res = await build({
|
||||
entryPoints: [swSrc],
|
||||
bundle: true,
|
||||
write: false,
|
||||
outfile: 'sw-pleroma.js',
|
||||
alias: esbuildAlias,
|
||||
plugins: [
|
||||
{
|
||||
name: 'vite-like-root-resolve',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue