1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Update webpack config

This commit is contained in:
Chocobozzz 2017-09-06 21:48:15 +02:00
parent a8b5de6c67
commit 04de542abd
8 changed files with 89 additions and 98 deletions

View file

@ -11,6 +11,7 @@ const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin')
const DefinePlugin = require('webpack/lib/DefinePlugin')
const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin')
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin')
const HotModuleReplacementPlugin = require('webpack/lib/HotModuleReplacementPlugin')
/**
* Webpack Constants
@ -18,14 +19,18 @@ const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin')
const ENV = process.env.ENV = process.env.NODE_ENV = 'development'
const HOST = process.env.HOST || 'localhost'
const PORT = process.env.PORT || 3000
const PUBLIC = process.env.PUBLIC_DEV || HOST + ':' + PORT
const AOT = process.env.BUILD_AOT || helpers.hasNpmFlag('aot')
const HMR = helpers.hasProcessFlag('hot')
const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, {
const METADATA = {
host: HOST,
port: PORT,
public: PUBLIC,
ENV: ENV,
HMR: HMR,
AOT: AOT,
API_URL: 'http://localhost:9000'
})
}
const DllBundlesPlugin = require('webpack-dll-bundles-plugin').DllBundlesPlugin
@ -125,11 +130,9 @@ module.exports = function (env) {
'HMR': METADATA.HMR,
'API_URL': JSON.stringify(METADATA.API_URL),
'process.version': JSON.stringify(process.version),
'process.env': {
'ENV': JSON.stringify(METADATA.ENV),
'NODE_ENV': JSON.stringify(METADATA.ENV),
'HMR': METADATA.HMR
}
'process.env.ENV': JSON.stringify(METADATA.ENV),
'process.env.NODE_ENV': JSON.stringify(METADATA.ENV),
'process.env.HMR': METADATA.HMR
}),
new DllBundlesPlugin({
@ -216,8 +219,9 @@ module.exports = function (env) {
}
}
})
}),
new HotModuleReplacementPlugin()
],
/**
@ -232,6 +236,7 @@ module.exports = function (env) {
port: METADATA.port,
host: METADATA.host,
historyApiFallback: true,
hot: METADATA.HMR,
watchOptions: {
ignored: /node_modules/
}