Reconfigured webpack to also have a development build.

This commit is contained in:
Harrison Deng 2022-04-17 20:12:13 -05:00
parent ef36e398b5
commit c0b324fba6
7 changed files with 33 additions and 3245 deletions

2
.eslintignore Normal file
View File

@ -0,0 +1,2 @@
webpack.*.js
webpack.*.cjs

2
Jenkinsfile vendored
View File

@ -11,7 +11,7 @@ pipeline {
stage("build") {
steps {
nodejs('NodeJS (17.4.0)') {
sh "npm run build"
sh "npm run build:dev"
}
}
}

3236
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,9 @@
"private": true,
"type": "module",
"scripts": {
"build": "webpack --config webpack.config.js",
"build:prod": "webpack --config webpack.prod.cjs",
"build:dev": "webpack --config webpack.dev.cjs",
"build": "webpack --config webpack.dev.cjs",
"test": "mocha tests/** --reporter mocha-junit-reporter --reporter-options mochaFile=./junit/test_results.xml",
"docs": "jsdoc src README.md -r -d docs -c jsdoc.config.json"
},
@ -22,14 +24,12 @@
"eslint": "^8.13.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^39.2.1",
"html-loader": "^3.1.0",
"jsdoc": "^3.6.10",
"mocha": "^9.2.2",
"mocha-junit-reporter": "^2.0.2",
"style-loader": "^3.3.1",
"webpack": "^5.72.0",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.8.1",
"webpack-merge": "^5.8.0"
}
}

View File

@ -1,7 +1,7 @@
import path from "path";
const path = require("path");
module.exports = {
export default {
mode: "production",
entry: {
audioshowkit: path.resolve("./src/audioshowkitlib.js"),
},
@ -26,9 +26,7 @@ export default {
output: {
filename: "[name].js",
path: path.resolve("./dist"),
library: ["[name]"]
library: ["[name]"],
clean: true
},
plugins: [
]
};

11
webpack.dev.cjs Normal file
View File

@ -0,0 +1,11 @@
const path = require("path");
const { merge } = require("webpack-merge");
const webpackCommon = require("./webpack.common.cjs");
const devConfig = {
mode: "development",
devtool: "eval-source-map",
};
module.exports = merge(webpackCommon, devConfig);

9
webpack.prod.cjs Normal file
View File

@ -0,0 +1,9 @@
const { merge } = require("webpack-merge");
const webpackCommon = require("./webpack.common.cjs");
const prodConfig = {
mode: "production",
};
module.exports = merge(webpackCommon, prodConfig);