mirror of
https://github.com/woutdp/live_svelte
synced 2026-05-24 09:28:21 +00:00
Improve build.js
This commit is contained in:
parent
272246e614
commit
b2b38d4cf3
4 changed files with 17 additions and 66 deletions
|
|
@ -15,6 +15,9 @@ let optsClient = {
|
|||
target: "es2017",
|
||||
outdir: "../priv/static/assets",
|
||||
logLevel: "info",
|
||||
minify: deploy,
|
||||
sourcemap: watch ? "inline" : false,
|
||||
watch,
|
||||
plugins: [
|
||||
importGlobPlugin(),
|
||||
sveltePlugin({
|
||||
|
|
@ -34,6 +37,8 @@ let optsServer = {
|
|||
target: "node19.6.1",
|
||||
outdir: "../priv/static/assets/server",
|
||||
logLevel: "info",
|
||||
sourcemap: watch ? "inline" : false,
|
||||
watch,
|
||||
plugins: [
|
||||
importGlobPlugin(),
|
||||
sveltePlugin({
|
||||
|
|
@ -43,44 +48,17 @@ let optsServer = {
|
|||
],
|
||||
}
|
||||
|
||||
if (watch) {
|
||||
optsClient = {
|
||||
...optsClient,
|
||||
watch,
|
||||
sourcemap: "inline",
|
||||
}
|
||||
|
||||
optsServer = {
|
||||
...optsServer,
|
||||
watch,
|
||||
sourcemap: "inline",
|
||||
}
|
||||
}
|
||||
|
||||
if (deploy) {
|
||||
optsClient = {
|
||||
...optsClient,
|
||||
minify: true,
|
||||
}
|
||||
}
|
||||
|
||||
const client = esbuild.build(optsClient)
|
||||
const server = esbuild.build(optsServer)
|
||||
|
||||
if (watch) {
|
||||
client.then(_result => {
|
||||
process.stdin.on("close", () => {
|
||||
process.exit(0)
|
||||
})
|
||||
|
||||
process.stdin.on("close", () => process.exit(0))
|
||||
process.stdin.resume()
|
||||
})
|
||||
|
||||
server.then(_result => {
|
||||
process.stdin.on("close", () => {
|
||||
process.exit(0)
|
||||
})
|
||||
|
||||
process.stdin.on("close", () => process.exit(0))
|
||||
process.stdin.resume()
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ let optsClient = {
|
|||
target: "es2017",
|
||||
outdir: "../priv/static/assets",
|
||||
logLevel: "info",
|
||||
minify: deploy,
|
||||
sourcemap: watch ? "inline" : false,
|
||||
watch,
|
||||
plugins: [
|
||||
importGlobPlugin(),
|
||||
sveltePlugin({
|
||||
|
|
@ -34,6 +37,8 @@ let optsServer = {
|
|||
target: "node19.6.1",
|
||||
outdir: "../priv/static/assets/server",
|
||||
logLevel: "info",
|
||||
sourcemap: watch ? "inline" : false,
|
||||
watch,
|
||||
plugins: [
|
||||
importGlobPlugin(),
|
||||
sveltePlugin({
|
||||
|
|
@ -43,49 +48,17 @@ let optsServer = {
|
|||
],
|
||||
}
|
||||
|
||||
if (watch) {
|
||||
optsClient = {
|
||||
...optsClient,
|
||||
watch,
|
||||
sourcemap: "inline",
|
||||
}
|
||||
|
||||
optsServer = {
|
||||
...optsServer,
|
||||
watch,
|
||||
sourcemap: "inline",
|
||||
}
|
||||
}
|
||||
|
||||
if (deploy) {
|
||||
optsClient = {
|
||||
...optsClient,
|
||||
minify: true,
|
||||
}
|
||||
|
||||
optsServer = {
|
||||
...optsServer,
|
||||
minify: true,
|
||||
}
|
||||
}
|
||||
|
||||
const client = esbuild.build(optsClient)
|
||||
const server = esbuild.build(optsServer)
|
||||
|
||||
if (watch) {
|
||||
client.then(_result => {
|
||||
process.stdin.on("close", () => {
|
||||
process.exit(0)
|
||||
})
|
||||
|
||||
process.stdin.on("close", () => process.exit(0))
|
||||
process.stdin.resume()
|
||||
})
|
||||
|
||||
server.then(_result => {
|
||||
process.stdin.on("close", () => {
|
||||
process.exit(0)
|
||||
})
|
||||
|
||||
process.stdin.on("close", () => process.exit(0))
|
||||
process.stdin.resume()
|
||||
})
|
||||
}
|
||||
|
|
|
|||
2
example_project/assets/package-lock.json
generated
2
example_project/assets/package-lock.json
generated
|
|
@ -21,7 +21,7 @@
|
|||
},
|
||||
"..": {},
|
||||
"../..": {
|
||||
"version": "0.3.5",
|
||||
"version": "0.4.0",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"prettier": "2.8.7",
|
||||
|
|
|
|||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "live_svelte",
|
||||
"version": "0.3.5",
|
||||
"version": "0.4.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "live_svelte",
|
||||
"version": "0.3.5",
|
||||
"version": "0.4.0",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"prettier": "2.8.7",
|
||||
|
|
|
|||
Loading…
Reference in a new issue