add dev mode support
This commit is contained in:
@@ -1,10 +1,37 @@
|
||||
|
||||
const webpack = require('webpack');
|
||||
const CopyPlugin = require("copy-webpack-plugin");
|
||||
const path = require('path');
|
||||
|
||||
const isDevServer = process.env.WEBPACK_SERVE;
|
||||
console.log("Dev server is " + isDevServer);
|
||||
var host;
|
||||
if (isDevServer){
|
||||
host = 'http://10.23.43.24';
|
||||
} else {
|
||||
host = '';
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
mode: "development",
|
||||
entry: ['./src/form.ts','./src/ota.ts', "./src/battery.ts"],
|
||||
devtool: 'inline-source-map',
|
||||
plugins: [
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
{
|
||||
from: "src/index.html",
|
||||
to: "index.html"
|
||||
}
|
||||
]
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
PUBLIC_URL: JSON.stringify(host),
|
||||
}),
|
||||
new webpack.EnvironmentPlugin({
|
||||
redirect: 'true'
|
||||
})
|
||||
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
@@ -21,4 +48,6 @@ module.exports = {
|
||||
filename: 'bundle.js',
|
||||
path: path.resolve(__dirname, '../src/webserver'),
|
||||
},
|
||||
devServer: {
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user