Skip to content

Commit e7005e1

Browse files
committed
Merge branch 'develop'
* develop: bump template version fix bug with #1202 Make CSS sourcemaps on by default Ensure page reloads in history mode serve index.html use old sourcemap option Add postcss-url to match postcss-import (#1115) Change engine>node{4 => 6} for template (#1206) Fix static file serving for publicPath != `/` (fix#1176) (#1180) Load, render template version using helper (#1202) fix typo in a comment (#1183) fix #1140
2 parents 2b90ae2 + 52003cd commit e7005e1

File tree

8 files changed

+34
-15
lines changed

8 files changed

+34
-15
lines changed

meta.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,24 @@ const {
66
runLintFix,
77
printMessage,
88
} = require('./utils')
9+
const pkg = require('./package.json')
10+
11+
const templateVersion = pkg.version
912

1013
module.exports = {
1114
helpers: {
12-
if_or: function(v1, v2, options) {
15+
if_or(v1, v2, options) {
1316
if (v1 || v2) {
1417
return options.fn(this)
1518
}
1619

1720
return options.inverse(this)
1821
},
22+
template_version() {
23+
return templateVersion
24+
},
1925
},
26+
2027
prompts: {
2128
name: {
2229
type: 'string',

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-cli-template-webpack",
3-
"version": "1.2.7",
3+
"version": "1.2.8",
44
"license": "MIT",
55
"description": "A full-featured Webpack setup with hot-reload, lint-on-save, unit testing & css extraction.",
66
"scripts": {

template/.postcssrc.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
module.exports = {
44
"plugins": {
5-
// to edit target browsers: use "browserslist" field in package.json
65
"postcss-import": {},
6+
"postcss-url": {},
7+
// to edit target browsers: use "browserslist" field in package.json
78
"autoprefixer": {}
89
}
910
}

template/build/webpack.base.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module.exports = {
5353
{
5454
test: /\.js$/,
5555
loader: 'babel-loader',
56-
include: [resolve('src'), resolve('test')]
56+
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
5757
},
5858
{
5959
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,

template/build/webpack.dev.conf.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ const utils = require('./utils')
33
const webpack = require('webpack')
44
const config = require('../config')
55
const merge = require('webpack-merge')
6+
const path = require('path')
67
const baseWebpackConfig = require('./webpack.base.conf')
8+
const CopyWebpackPlugin = require('copy-webpack-plugin')
79
const HtmlWebpackPlugin = require('html-webpack-plugin')
810
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
911
const portfinder = require('portfinder')
@@ -21,8 +23,13 @@ const devWebpackConfig = merge(baseWebpackConfig, {
2123
// these devServer options should be customized in /config/index.js
2224
devServer: {
2325
clientLogLevel: 'warning',
24-
historyApiFallback: true,
26+
historyApiFallback: {
27+
rewrites: [
28+
{ from: /.*/, to: path.join(config.dev.assetsPublicPath, 'index.html') },
29+
],
30+
},
2531
hot: true,
32+
contentBase: false, // since we use CopyWebpackPlugin.
2633
compress: true,
2734
host: HOST || config.dev.host,
2835
port: PORT || config.dev.port,
@@ -50,6 +57,14 @@ const devWebpackConfig = merge(baseWebpackConfig, {
5057
template: 'index.html',
5158
inject: true
5259
}),
60+
// copy custom static assets
61+
new CopyWebpackPlugin([
62+
{
63+
from: path.resolve(__dirname, '../static'),
64+
to: config.dev.assetsSubDirectory,
65+
ignore: ['.*']
66+
}
67+
])
5368
]
5469
})
5570

template/build/webpack.prod.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const webpackConfig = merge(baseWebpackConfig, {
7878
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
7979
chunksSortMode: 'dependency'
8080
}),
81-
// keep module.id stable when vender modules does not change
81+
// keep module.id stable when vendor modules does not change
8282
new webpack.HashedModuleIdsPlugin(),
8383
// enable scope hoisting
8484
new webpack.optimize.ModuleConcatenationPlugin(),

template/config/index.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict'
2-
// Template version: 1.2.7
2+
// Template version: {{ template_version }}
33
// see http://vuejs-templates.github.io/webpack for documentation.
44

55
const path = require('path')
@@ -34,19 +34,14 @@ module.exports = {
3434
*/
3535

3636
// https://webpack.js.org/configuration/devtool/#development
37-
devtool: 'eval-source-map',
37+
devtool: 'cheap-module-eval-source-map',
3838

3939
// If you have problems debugging vue-files in devtools,
4040
// set this to false - it *may* help
4141
// https://vue-loader.vuejs.org/en/options.html#cachebusting
4242
cacheBusting: true,
4343

44-
// CSS Sourcemaps off by default because relative paths are "buggy"
45-
// with this option, according to the CSS-Loader README
46-
// (https://github.com/webpack/css-loader#sourcemaps)
47-
// In our experience, they generally work as expected,
48-
// just be aware of this issue when enabling this option.
49-
cssSourceMap: false,
44+
cssSourceMap: true,
5045
},
5146

5247
build: {

template/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
"node-notifier": "^5.1.2",
103103
"postcss-import": "^11.0.0",
104104
"postcss-loader": "^2.0.8",
105+
"postcss-url": "^7.2.1",
105106
"semver": "^5.3.0",
106107
"shelljs": "^0.7.6",
107108
"optimize-css-assets-webpack-plugin": "^3.2.0",
@@ -118,7 +119,7 @@
118119
"webpack-merge": "^4.1.0"
119120
},
120121
"engines": {
121-
"node": ">= 4.0.0",
122+
"node": ">= 6.0.0",
122123
"npm": ">= 3.0.0"
123124
},
124125
"browserslist": [

0 commit comments

Comments
 (0)