Visual Console Client: improved the build system
Former-commit-id: ced96606af3fd36d2d77a2963df7ca70f4174d6e
This commit is contained in:
parent
10cb9c969b
commit
fe61d38686
|
@ -3,7 +3,10 @@
|
|||
"version": "1.0.0",
|
||||
"description": "Visual Console",
|
||||
"scripts": {
|
||||
"clean-build": "node ./scripts/clean-build.js",
|
||||
"prebuild": "npm run clean-build",
|
||||
"build": "NODE_ENV=production webpack",
|
||||
"prebuild:dev": "npm run clean-build",
|
||||
"build:dev": "NODE_ENV=NODE_ENV=production webpack",
|
||||
"build:watch": "NODE_ENV=NODE_ENV=production webpack --watch",
|
||||
"format": "prettier",
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
|
||||
const buildPath = path.join(__dirname, "..", "build");
|
||||
|
||||
if (fs.existsSync(buildPath)) {
|
||||
fs.readdirSync(buildPath).forEach(file =>
|
||||
fs.unlinkSync(path.join(buildPath, file))
|
||||
);
|
||||
}
|
|
@ -6,7 +6,7 @@ module.exports = {
|
|||
mode: dev ? "development" : "production",
|
||||
entry: __dirname + "/src/index.ts", // Start from this file.
|
||||
output: {
|
||||
path: __dirname + "/dist", // The files will be created here.
|
||||
path: __dirname + "/build", // The files will be created here.
|
||||
filename: dev
|
||||
? "visual-console-client.min.js"
|
||||
: "visual-console-client.[hash].min.js",
|
||||
|
|
Loading…
Reference in New Issue