mirror of
https://github.com/pyscript/pyscript.git
synced 2026-02-22 05:01:25 -05:00
Use only single rollup-plugin-copy() to avoid race condition (#843)
* Use only single copy() plugin to avoid race condition * clean production def, better copy_target structure * Restore '!process.env.ROLLUP_WATCH to production definition Co-authored-by: Ted Patrick <tpatrick@anaconda.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import commonjs from "@rollup/plugin-commonjs";
|
||||
import resolve from "@rollup/plugin-node-resolve";
|
||||
import livereload from "rollup-plugin-livereload";
|
||||
import { terser } from "rollup-plugin-terser";
|
||||
import legacy from '@rollup/plugin-legacy';
|
||||
import typescript from "@rollup/plugin-typescript";
|
||||
@@ -11,15 +10,25 @@ import copy from 'rollup-plugin-copy'
|
||||
|
||||
const production = !process.env.ROLLUP_WATCH || (process.env.NODE_ENV === "production");
|
||||
|
||||
const copy_targets = {
|
||||
targets: [
|
||||
{ src: 'public/index.html', dest: 'build' }
|
||||
]
|
||||
}
|
||||
|
||||
if( !production ){
|
||||
copy_targets.targets.push({ src: 'build/*', dest: 'examples/build' })
|
||||
}
|
||||
|
||||
export default {
|
||||
input: "src/main.ts",
|
||||
output: [
|
||||
output:[
|
||||
{
|
||||
sourcemap: true,
|
||||
format: "iife",
|
||||
inlineDynamicImports: true,
|
||||
name: "app",
|
||||
file: "build/pyscript.js",
|
||||
sourcemap: true,
|
||||
format: "iife",
|
||||
inlineDynamicImports: true,
|
||||
name: "app",
|
||||
file: "build/pyscript.js",
|
||||
},
|
||||
{
|
||||
file: "build/pyscript.min.js",
|
||||
@@ -46,23 +55,12 @@ export default {
|
||||
inlineSources: !production,
|
||||
}),
|
||||
// This will make sure that examples will always get the latest build folder
|
||||
!production && copy({
|
||||
targets: [
|
||||
{ src: 'build/*', dest: 'examples/build' },
|
||||
]
|
||||
}),
|
||||
copy({
|
||||
targets: [
|
||||
{ src: 'public/index.html', dest: 'build' },
|
||||
]
|
||||
}),
|
||||
!production && serve(),
|
||||
!production && livereload("public"),
|
||||
copy(copy_targets),
|
||||
// production && terser(),
|
||||
!production && serve({
|
||||
port: 8080,
|
||||
contentBase: 'examples'
|
||||
})
|
||||
contentBase: 'examples'}
|
||||
)
|
||||
],
|
||||
watch: {
|
||||
clearScreen: false,
|
||||
|
||||
Reference in New Issue
Block a user