chore: allow to modify devserver port

pull/13/head
moonrailgun 4 years ago
parent 73fdb032a5
commit 734faaa9a5

@ -46,6 +46,7 @@
"copy-webpack-plugin": "^9.0.1",
"cross-env": "^7.0.3",
"css-loader": "^5.2.6",
"dotenv": "^10.0.0",
"esbuild-loader": "^2.13.1",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.3.2",

@ -2,7 +2,7 @@
* Reference: https://webpack.js.org/configuration/configuration-languages/
*/
import type { Configuration, WebpackPluginInstance } from 'webpack';
import type { Configuration } from 'webpack';
import { DefinePlugin } from 'webpack';
import type WebpackDevServer from 'webpack-dev-server';
import path from 'path';
@ -11,12 +11,16 @@ import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import CopyPlugin from 'copy-webpack-plugin';
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('dotenv').config();
delete process.env.TS_NODE_PROJECT; // https://github.com/dividab/tsconfig-paths-webpack-plugin/issues/32
require('../build/script/buildPublicTranslation.js'); // 编译前先执行一下构建翻译的脚本
const ROOT_PATH = path.resolve(__dirname, './');
const DIST_PATH = path.resolve(ROOT_PATH, './dist');
const ASSET_PATH = process.env.ASSET_PATH || '/';
const PORT = Number(process.env.PORT || 11011);
declare module 'webpack' {
interface Configuration {
@ -38,7 +42,7 @@ const config: Configuration = {
publicPath: ASSET_PATH,
},
devServer: {
port: 11011,
port: PORT,
historyApiFallback: true,
},
module: {

@ -3241,6 +3241,11 @@ dot-prop@^5.1.0:
dependencies:
is-obj "^2.0.0"
dotenv@^10.0.0:
version "10.0.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81"
integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==
duplexify@^3.6.0:
version "3.7.1"
resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.7.1.tgz#2a4df5317f6ccfd91f86d6fd25d8d8a103b88309"

Loading…
Cancel
Save