mirror of
https://github.com/transmission/transmission
synced 2025-01-30 19:03:04 +00:00
chore(web): dev environment (#1489)
This commit is contained in:
parent
61d221c8bb
commit
5f811e4604
3 changed files with 613 additions and 19 deletions
|
@ -4,6 +4,7 @@
|
|||
"repository": "https://github.com/transmission/transmission",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev": "WEBPACK_MODE=development webpack-dev-server --config webpack.config.js",
|
||||
"build": "webpack --config webpack.config.js",
|
||||
"css": "sass --no-source-map style/",
|
||||
"css:map": "sass style/",
|
||||
|
@ -45,7 +46,8 @@
|
|||
"url-loader": "^4.1.0",
|
||||
"webpack": "^4.44.2",
|
||||
"webpack-bundle-analyzer": "^3.9.0",
|
||||
"webpack-cli": "^3.3.12"
|
||||
"webpack-cli": "^3.3.12",
|
||||
"webpack-dev-server": "^3.11.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash.isequal": "^4.5.0"
|
||||
|
|
|
@ -6,8 +6,10 @@ const TerserPlugin = require('terser-webpack-plugin');
|
|||
const webpack = require('webpack');
|
||||
|
||||
const mode = process.env.WEBPACK_MODE || 'production';
|
||||
const devPort = process.env.DEV_PORT || 9000;
|
||||
const rpcUrl = process.env.RPC_URL || 'http://localhost:9091/transmission/rpc';
|
||||
|
||||
module.exports = {
|
||||
const config = {
|
||||
devtool: 'source-map',
|
||||
entry: './src/main.js',
|
||||
mode,
|
||||
|
@ -52,7 +54,7 @@ module.exports = {
|
|||
},
|
||||
output: {
|
||||
filename: 'transmission-app.js' ,
|
||||
path: path.resolve(__dirname, 'public_html'),
|
||||
path: path.resolve(__dirname, 'public_html'),
|
||||
sourceMapFilename: 'transmission-app.js.map'
|
||||
},
|
||||
plugins: [
|
||||
|
@ -69,3 +71,22 @@ module.exports = {
|
|||
},
|
||||
};
|
||||
|
||||
if (mode === 'development') {
|
||||
config.devServer = {
|
||||
compress: true,
|
||||
contentBase: path.join(__dirname, 'public_html'),
|
||||
historyApiFallback: {
|
||||
rewrites: [
|
||||
{ from: '/transmission/web', to: '/' },
|
||||
]
|
||||
},
|
||||
hot: true,
|
||||
port: devPort,
|
||||
proxy: {
|
||||
'/rpc': rpcUrl
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = config;
|
||||
|
||||
|
|
603
web/yarn.lock
603
web/yarn.lock
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue