1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-12 14:23:32 +00:00

switch to webpack-dev-server

This commit is contained in:
Kyle Spearrin
2018-09-18 11:59:03 -04:00
parent dffcff48a0
commit 027cad9e52
3 changed files with 1595 additions and 1443 deletions

3031
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,14 +6,14 @@
"sub:update": "git submodule update --remote", "sub:update": "git submodule update --remote",
"sub:pull": "git submodule foreach git pull", "sub:pull": "git submodule foreach git pull",
"postinstall": "npm run sub:init", "postinstall": "npm run sub:init",
"build": "gulp prebuild && webpack --config webpack.config.js", "build": "gulp prebuild && webpack",
"build:watch": "gulp prebuild && webpack-serve --config webpack.config.js", "build:watch": "gulp prebuild && webpack-dev-server",
"build:prod": "gulp prebuild && cross-env NODE_ENV=production webpack --config webpack.config.js", "build:prod": "gulp prebuild && cross-env NODE_ENV=production webpack",
"build:prod:watch": "gulp prebuild && cross-env NODE_ENV=production webpack-serve --config webpack.config.js", "build:prod:watch": "gulp prebuild && cross-env NODE_ENV=production webpack-dev-server",
"build:selfhost": "gulp prebuild && cross-env SELF_HOST=true webpack-serve --config webpack.config.js", "build:selfhost": "gulp prebuild && cross-env SELF_HOST=true webpack-dev-server",
"build:selfhost:watch": "gulp prebuild && cross-env SELF_HOST=true webpack-serve --config webpack.config.js", "build:selfhost:watch": "gulp prebuild && cross-env SELF_HOST=true webpack-dev-server",
"build:selfhost:prod": "gulp prebuild && cross-env SELF_HOST=true NODE_ENV=production webpack --config webpack.config.js", "build:selfhost:prod": "gulp prebuild && cross-env SELF_HOST=true NODE_ENV=production webpack",
"build:selfhost:prod:watch": "gulp prebuild && cross-env SELF_HOST=true NODE_ENV=production webpack-serve --config webpack.config.js", "build:selfhost:prod:watch": "gulp prebuild && cross-env SELF_HOST=true NODE_ENV=production webpack-dev-server",
"clean:l10n": "git push origin --delete l10n_master", "clean:l10n": "git push origin --delete l10n_master",
"dist": "npm run build:prod && gulp postdist", "dist": "npm run build:prod && gulp postdist",
"dist:selfhost": "npm run build:selfhost:prod && gulp postdist", "dist:selfhost": "npm run build:selfhost:prod && gulp postdist",
@@ -52,7 +52,7 @@
"typescript": "^2.7.2", "typescript": "^2.7.2",
"webpack": "^4.18.0", "webpack": "^4.18.0",
"webpack-cli": "^3.1.0", "webpack-cli": "^3.1.0",
"webpack-serve": "^2.0.2" "webpack-dev-server": "^3.1.8"
}, },
"dependencies": { "dependencies": {
"@angular/animations": "6.1.7", "@angular/animations": "6.1.7",

View File

@@ -130,22 +130,21 @@ if (ENV === 'production') {
}); });
} }
// ref: https://webpack.js.org/configuration/dev-server/#devserver
let certSuffix = fs.existsSync('dev-server.local.pem') ? '.local' : '.shared'; let certSuffix = fs.existsSync('dev-server.local.pem') ? '.local' : '.shared';
const serve = { const devServer = {
https: { https: {
key: fs.readFileSync('dev-server' + certSuffix + '.pem'), key: fs.readFileSync('dev-server' + certSuffix + '.pem'),
cert: fs.readFileSync('dev-server' + certSuffix + '.pem'), cert: fs.readFileSync('dev-server' + certSuffix + '.pem'),
}, },
// host: '192.168.1.9', // host: '192.168.1.9',
hot: false,
// host client has issues. ref: https://github.com/webpack-contrib/webpack-serve/issues/233
// hotClient: false,
}; };
const config = { const config = {
mode: ENV, mode: ENV,
devtool: 'source-map', devtool: 'source-map',
serve: serve, devServer: devServer,
entry: { entry: {
'app/polyfills': './src/app/polyfills.ts', 'app/polyfills': './src/app/polyfills.ts',
'app/main': './src/app/main.ts', 'app/main': './src/app/main.ts',