Skip to content

Commit

Permalink
Review Webpack configuration
Browse files Browse the repository at this point in the history
Fix configuration for local serving (opening browser fails on Ubuntu)
Ensure the packaging links are OK
  • Loading branch information
cyChop committed Jan 3, 2018
1 parent 2ab8eb3 commit b2aa4d4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {
dev: {
env: require('./dev.env'),
port: 8080,
autoOpenBrowser: true,
autoOpenBrowser: false,
assetsSubDirectory: 'static',
assetsPublicPath: '',
proxyTable: {},
Expand Down
11 changes: 10 additions & 1 deletion gulp/webpack.dev.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')

Expand Down Expand Up @@ -32,8 +33,16 @@ module.exports = lg => {
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: false
inject: true
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: utils.resolve('static'),
to: config.build.assetsSubDirectory,
ignore: ['.*']
}
]),
new FriendlyErrorsPlugin()
]
})
Expand Down
5 changes: 2 additions & 3 deletions gulp/webpack.prod.conf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const path = require('path')
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
Expand Down Expand Up @@ -59,7 +58,7 @@ module.exports = lg => {
? 'index.html'
: config.build.index,
template: 'index.html',
inject: false,
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
Expand Down Expand Up @@ -93,7 +92,7 @@ module.exports = lg => {
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
from: utils.resolve('static'),
to: config.build.assetsSubDirectory,
ignore: ['.*']
}
Expand Down
2 changes: 0 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<meta name="theme-color" content="#ffc40d">
<meta name="msapplication-config" content="static/icons/browserconfig.xml">

<link href="static/css/beverages.css" rel="stylesheet"/>
<link href="static/css/demo.css" rel="stylesheet"/>

<script>
Expand Down Expand Up @@ -41,5 +40,4 @@
</div>
</footer>
</body>
<script type="text/javascript" src="static/js/beverages.fr.js"></script>
</html>

0 comments on commit b2aa4d4

Please sign in to comment.