mirror of
https://github.com/KevinMidboe/vue-chartjs.git
synced 2026-07-27 12:12:17 +00:00
update webpack to version 3
This commit is contained in:
+34
-28
@@ -1,35 +1,41 @@
|
|||||||
// https://github.com/shelljs/shelljs
|
'use strict'
|
||||||
require('shelljs/global')
|
require('./check-versions')()
|
||||||
env.NODE_ENV = 'production'
|
|
||||||
|
|
||||||
var path = require('path')
|
process.env.NODE_ENV = 'production'
|
||||||
var config = require('../config')
|
|
||||||
var ora = require('ora')
|
|
||||||
var webpack = require('webpack')
|
|
||||||
var webpackConfig = require('./webpack.prod.conf')
|
|
||||||
|
|
||||||
console.log(
|
const ora = require('ora')
|
||||||
' Tip:\n' +
|
const rm = require('rimraf')
|
||||||
' Built files are meant to be served over an HTTP server.\n' +
|
const path = require('path')
|
||||||
' Opening index.html over file:// won\'t work.\n'
|
const chalk = require('chalk')
|
||||||
)
|
const webpack = require('webpack')
|
||||||
|
const config = require('../config')
|
||||||
|
const webpackConfig = require('./webpack.prod.conf')
|
||||||
|
|
||||||
var spinner = ora('building UMD module...')
|
const spinner = ora('building for production...')
|
||||||
spinner.start()
|
spinner.start()
|
||||||
|
|
||||||
var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
|
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
|
||||||
rm('-rf', assetsPath)
|
|
||||||
mkdir('-p', assetsPath)
|
|
||||||
|
|
||||||
|
|
||||||
webpack(webpackConfig, function (err, stats) {
|
|
||||||
spinner.stop()
|
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
process.stdout.write(stats.toString({
|
webpack(webpackConfig, function (err, stats) {
|
||||||
colors: true,
|
spinner.stop()
|
||||||
modules: false,
|
if (err) throw err
|
||||||
children: false,
|
process.stdout.write(stats.toString({
|
||||||
chunks: false,
|
colors: true,
|
||||||
chunkModules: false
|
modules: false,
|
||||||
}) + '\n')
|
children: false,
|
||||||
|
chunks: false,
|
||||||
|
chunkModules: false
|
||||||
|
}) + '\n\n')
|
||||||
|
|
||||||
|
if (stats.hasErrors()) {
|
||||||
|
console.log(chalk.red(' Build failed with errors.\n'))
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(chalk.cyan(' Build complete.\n'))
|
||||||
|
console.log(chalk.yellow(
|
||||||
|
' Tip: built files are meant to be served over an HTTP server.\n' +
|
||||||
|
' Opening index.html over file:// won\'t work.\n'
|
||||||
|
))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
'use strict'
|
||||||
|
const chalk = require('chalk')
|
||||||
|
const semver = require('semver')
|
||||||
|
const packageConfig = require('../package.json')
|
||||||
|
const shell = require('shelljs')
|
||||||
|
function exec (cmd) {
|
||||||
|
return require('child_process').execSync(cmd).toString().trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
const versionRequirements = [
|
||||||
|
{
|
||||||
|
name: 'node',
|
||||||
|
currentVersion: semver.clean(process.version),
|
||||||
|
versionRequirement: packageConfig.engines.node
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
if (shell.which('npm')) {
|
||||||
|
versionRequirements.push({
|
||||||
|
name: 'npm',
|
||||||
|
currentVersion: exec('npm --version'),
|
||||||
|
versionRequirement: packageConfig.engines.npm
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = function () {
|
||||||
|
const warnings = []
|
||||||
|
for (let i = 0; i < versionRequirements.length; i++) {
|
||||||
|
const mod = versionRequirements[i]
|
||||||
|
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
|
||||||
|
warnings.push(mod.name + ': ' +
|
||||||
|
chalk.red(mod.currentVersion) + ' should be ' +
|
||||||
|
chalk.green(mod.versionRequirement)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (warnings.length) {
|
||||||
|
console.log('')
|
||||||
|
console.log(chalk.yellow('To use this template, you must update following to modules:'))
|
||||||
|
console.log()
|
||||||
|
for (let i = 0; i < warnings.length; i++) {
|
||||||
|
const warning = warnings[i]
|
||||||
|
console.log(' ' + warning)
|
||||||
|
}
|
||||||
|
console.log()
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
|
'use strict'
|
||||||
require('eventsource-polyfill')
|
require('eventsource-polyfill')
|
||||||
var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
|
var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
|
||||||
|
|
||||||
|
|||||||
+77
-35
@@ -1,45 +1,61 @@
|
|||||||
var path = require('path')
|
'use strict'
|
||||||
var express = require('express')
|
require('./check-versions')()
|
||||||
var webpack = require('webpack')
|
|
||||||
var config = require('../config')
|
const config = require('../config')
|
||||||
var proxyMiddleware = require('http-proxy-middleware')
|
if (!process.env.NODE_ENV) {
|
||||||
var webpackConfig = process.env.NODE_ENV === 'testing'
|
process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
|
||||||
|
}
|
||||||
|
|
||||||
|
const opn = require('opn')
|
||||||
|
const path = require('path')
|
||||||
|
const express = require('express')
|
||||||
|
const webpack = require('webpack')
|
||||||
|
const proxyMiddleware = require('http-proxy-middleware')
|
||||||
|
const webpackConfig = (process.env.NODE_ENV === 'testing' || process.env.NODE_ENV === 'production')
|
||||||
? require('./webpack.prod.conf')
|
? require('./webpack.prod.conf')
|
||||||
: require('./webpack.dev.conf')
|
: require('./webpack.dev.conf')
|
||||||
|
|
||||||
// default port where dev server listens for incoming traffic
|
// default port where dev server listens for incoming traffic
|
||||||
var port = process.env.PORT || config.dev.port
|
const port = process.env.PORT || config.dev.port
|
||||||
|
// automatically open browser, if not set will be false
|
||||||
|
const autoOpenBrowser = !!config.dev.autoOpenBrowser
|
||||||
// Define HTTP proxies to your custom API backend
|
// Define HTTP proxies to your custom API backend
|
||||||
// https://github.com/chimurai/http-proxy-middleware
|
// https://github.com/chimurai/http-proxy-middleware
|
||||||
var proxyTable = config.dev.proxyTable
|
const proxyTable = config.dev.proxyTable
|
||||||
|
|
||||||
var app = express()
|
const app = express()
|
||||||
var compiler = webpack(webpackConfig)
|
const compiler = webpack(webpackConfig)
|
||||||
|
|
||||||
var devMiddleware = require('webpack-dev-middleware')(compiler, {
|
const devMiddleware = require('webpack-dev-middleware')(compiler, {
|
||||||
publicPath: webpackConfig.output.publicPath,
|
publicPath: webpackConfig.output.publicPath,
|
||||||
stats: {
|
quiet: true
|
||||||
colors: true,
|
|
||||||
chunks: false
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
var hotMiddleware = require('webpack-hot-middleware')(compiler)
|
const hotMiddleware = require('webpack-hot-middleware')(compiler, {
|
||||||
// force page reload when html-webpack-plugin template changes
|
log: false,
|
||||||
compiler.plugin('compilation', function (compilation) {
|
heartbeat: 2000
|
||||||
compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
|
|
||||||
hotMiddleware.publish({ action: 'reload' })
|
|
||||||
cb()
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
// force page reload when html-webpack-plugin template changes
|
||||||
|
// currently disabled until this is resolved:
|
||||||
|
// https://github.com/jantimon/html-webpack-plugin/issues/680
|
||||||
|
// compiler.plugin('compilation', function (compilation) {
|
||||||
|
// compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
|
||||||
|
// hotMiddleware.publish({ action: 'reload' })
|
||||||
|
// cb()
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
|
||||||
|
// enable hot-reload and state-preserving
|
||||||
|
// compilation error display
|
||||||
|
app.use(hotMiddleware)
|
||||||
|
|
||||||
// proxy api requests
|
// proxy api requests
|
||||||
Object.keys(proxyTable).forEach(function (context) {
|
Object.keys(proxyTable).forEach(function (context) {
|
||||||
var options = proxyTable[context]
|
const options = proxyTable[context]
|
||||||
if (typeof options === 'string') {
|
if (typeof options === 'string') {
|
||||||
options = { target: options }
|
options = { target: options }
|
||||||
}
|
}
|
||||||
app.use(proxyMiddleware(context, options))
|
app.use(proxyMiddleware(options.filter || context, options))
|
||||||
})
|
})
|
||||||
|
|
||||||
// handle fallback for HTML5 history API
|
// handle fallback for HTML5 history API
|
||||||
@@ -48,18 +64,44 @@ app.use(require('connect-history-api-fallback')())
|
|||||||
// serve webpack bundle output
|
// serve webpack bundle output
|
||||||
app.use(devMiddleware)
|
app.use(devMiddleware)
|
||||||
|
|
||||||
// enable hot-reload and state-preserving
|
|
||||||
// compilation error display
|
|
||||||
app.use(hotMiddleware)
|
|
||||||
|
|
||||||
// serve pure static assets
|
// serve pure static assets
|
||||||
var staticPath = path.posix.join(config.build.assetsPublicPath, config.build.assetsSubDirectory)
|
const staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
|
||||||
app.use(staticPath, express.static('./static'))
|
app.use(staticPath, express.static('./static'))
|
||||||
|
|
||||||
module.exports = app.listen(port, function (err) {
|
const uri = 'http://localhost:' + port
|
||||||
if (err) {
|
|
||||||
console.log(err)
|
var _resolve
|
||||||
return
|
var _reject
|
||||||
}
|
var readyPromise = new Promise((resolve, reject) => {
|
||||||
console.log('Listening at http://localhost:' + port + '\n')
|
_resolve = resolve
|
||||||
|
_reject = reject
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var server
|
||||||
|
var portfinder = require('portfinder')
|
||||||
|
portfinder.basePort = port
|
||||||
|
|
||||||
|
console.log('> Starting dev server...')
|
||||||
|
devMiddleware.waitUntilValid(() => {
|
||||||
|
portfinder.getPort((err, port) => {
|
||||||
|
if (err) {
|
||||||
|
_reject(err)
|
||||||
|
}
|
||||||
|
process.env.PORT = port
|
||||||
|
var uri = 'http://localhost:' + port
|
||||||
|
console.log('> Listening at ' + uri + '\n')
|
||||||
|
// when env is testing, don't need open it
|
||||||
|
if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
|
||||||
|
opn(uri)
|
||||||
|
}
|
||||||
|
server = app.listen(port)
|
||||||
|
_resolve()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
ready: readyPromise,
|
||||||
|
close: () => {
|
||||||
|
server.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+50
-34
@@ -1,55 +1,71 @@
|
|||||||
var path = require('path')
|
'use strict'
|
||||||
var config = require('../config')
|
const path = require('path')
|
||||||
var ExtractTextPlugin = require('extract-text-webpack-plugin')
|
const config = require('../config')
|
||||||
|
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||||
|
|
||||||
exports.assetsPath = function (_path) {
|
exports.assetsPath = function (_path) {
|
||||||
return path.posix.join(config.build.assetsSubDirectory, _path)
|
const assetsSubDirectory = process.env.NODE_ENV === 'production'
|
||||||
|
? config.build.assetsSubDirectory
|
||||||
|
: config.dev.assetsSubDirectory
|
||||||
|
return path.posix.join(assetsSubDirectory, _path)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.cssLoaders = function (options) {
|
exports.cssLoaders = function (options) {
|
||||||
options = options || {}
|
options = options || {}
|
||||||
// generate loader string to be used with extract text plugin
|
|
||||||
function generateLoaders (loaders) {
|
|
||||||
var sourceLoader = loaders.map(function (loader) {
|
|
||||||
var extraParamChar
|
|
||||||
if (/\?/.test(loader)) {
|
|
||||||
loader = loader.replace(/\?/, '-loader?')
|
|
||||||
extraParamChar = '&'
|
|
||||||
} else {
|
|
||||||
loader = loader + '-loader'
|
|
||||||
extraParamChar = '?'
|
|
||||||
}
|
|
||||||
return loader + (options.sourceMap ? extraParamChar + 'sourceMap' : '')
|
|
||||||
}).join('!')
|
|
||||||
|
|
||||||
if (options.extract) {
|
const cssLoader = {
|
||||||
return ExtractTextPlugin.extract('vue-style-loader', sourceLoader)
|
loader: 'css-loader',
|
||||||
} else {
|
options: {
|
||||||
return ['vue-style-loader', sourceLoader].join('!')
|
minimize: process.env.NODE_ENV === 'production',
|
||||||
|
sourceMap: options.sourceMap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://vuejs.github.io/vue-loader/configurations/extract-css.html
|
// generate loader string to be used with extract text plugin
|
||||||
|
function generateLoaders (loader, loaderOptions) {
|
||||||
|
const loaders = [cssLoader]
|
||||||
|
if (loader) {
|
||||||
|
loaders.push({
|
||||||
|
loader: loader + '-loader',
|
||||||
|
options: Object.assign({}, loaderOptions, {
|
||||||
|
sourceMap: options.sourceMap
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract CSS when that option is specified
|
||||||
|
// (which is the case during production build)
|
||||||
|
if (options.extract) {
|
||||||
|
return ExtractTextPlugin.extract({
|
||||||
|
use: loaders,
|
||||||
|
fallback: 'vue-style-loader'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
return ['vue-style-loader'].concat(loaders)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
|
||||||
return {
|
return {
|
||||||
css: generateLoaders(['css']),
|
css: generateLoaders(),
|
||||||
postcss: generateLoaders(['css']),
|
postcss: generateLoaders(),
|
||||||
less: generateLoaders(['css', 'less']),
|
less: generateLoaders('less'),
|
||||||
sass: generateLoaders(['css', 'sass?indentedSyntax']),
|
sass: generateLoaders('sass', { indentedSyntax: true }),
|
||||||
scss: generateLoaders(['css', 'sass']),
|
scss: generateLoaders('sass'),
|
||||||
stylus: generateLoaders(['css', 'stylus']),
|
stylus: generateLoaders('stylus'),
|
||||||
styl: generateLoaders(['css', 'stylus'])
|
styl: generateLoaders('stylus')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate loaders for standalone style files (outside of .vue)
|
// Generate loaders for standalone style files (outside of .vue)
|
||||||
exports.styleLoaders = function (options) {
|
exports.styleLoaders = function (options) {
|
||||||
var output = []
|
const output = []
|
||||||
var loaders = exports.cssLoaders(options)
|
const loaders = exports.cssLoaders(options)
|
||||||
for (var extension in loaders) {
|
for (const extension in loaders) {
|
||||||
var loader = loaders[extension]
|
const loader = loaders[extension]
|
||||||
output.push({
|
output.push({
|
||||||
test: new RegExp('\\.' + extension + '$'),
|
test: new RegExp('\\.' + extension + '$'),
|
||||||
loader: loader
|
use: loader
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return output
|
return output
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
'use strict'
|
||||||
|
const utils = require('./utils')
|
||||||
|
const config = require('../config')
|
||||||
|
const isProduction = process.env.NODE_ENV === 'production'
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
loaders: utils.cssLoaders({
|
||||||
|
sourceMap: isProduction
|
||||||
|
? config.build.productionSourceMap
|
||||||
|
: config.dev.cssSourceMap,
|
||||||
|
extract: isProduction
|
||||||
|
}),
|
||||||
|
transformToRequire: {
|
||||||
|
video: 'src',
|
||||||
|
source: 'src',
|
||||||
|
img: 'src',
|
||||||
|
image: 'xlink:href'
|
||||||
|
}
|
||||||
|
}
|
||||||
+42
-51
@@ -1,7 +1,12 @@
|
|||||||
var path = require('path')
|
'use strict'
|
||||||
var config = require('../config')
|
const path = require('path')
|
||||||
var utils = require('./utils')
|
const utils = require('./utils')
|
||||||
var projectRoot = path.resolve(__dirname, '../')
|
const config = require('../config')
|
||||||
|
const vueLoaderConfig = require('./vue-loader.conf')
|
||||||
|
|
||||||
|
function resolve (dir) {
|
||||||
|
return path.join(__dirname, '..', dir)
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: {
|
||||||
@@ -9,77 +14,63 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
path: config.build.assetsRoot,
|
path: config.build.assetsRoot,
|
||||||
publicPath: config.build.assetsPublicPath,
|
filename: '[name].js',
|
||||||
filename: '[name].js'
|
publicPath: process.env.NODE_ENV === 'production'
|
||||||
|
? config.build.assetsPublicPath
|
||||||
|
: config.dev.assetsPublicPath
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['', '.js', '.vue'],
|
extensions: ['.js', '.vue', '.json'],
|
||||||
fallback: [path.join(__dirname, '../node_modules')],
|
|
||||||
alias: {
|
alias: {
|
||||||
'src': path.resolve(__dirname, '../src'),
|
'vue$': 'vue/dist/vue.esm.js',
|
||||||
'mixins': path.resolve(__dirname, '../src/mixins'),
|
'@': resolve('src')
|
||||||
'BaseCharts': path.resolve(__dirname, '../src/BaseCharts')
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
resolveLoader: {
|
|
||||||
fallback: [path.join(__dirname, '../node_modules')]
|
|
||||||
},
|
|
||||||
module: {
|
module: {
|
||||||
preLoaders: [
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.(js|vue)$/,
|
||||||
|
loader: 'eslint-loader',
|
||||||
|
enforce: 'pre',
|
||||||
|
include: [resolve('src'), resolve('test')],
|
||||||
|
options: {
|
||||||
|
formatter: require('eslint-friendly-formatter')
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
test: /\.vue$/,
|
test: /\.vue$/,
|
||||||
loader: 'eslint',
|
loader: 'vue-loader',
|
||||||
include: projectRoot,
|
options: vueLoaderConfig
|
||||||
exclude: /node_modules/
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
loader: 'eslint',
|
loader: 'babel-loader',
|
||||||
include: projectRoot,
|
include: [resolve('src'), resolve('test')]
|
||||||
exclude: /node_modules/
|
|
||||||
}
|
|
||||||
],
|
|
||||||
loaders: [
|
|
||||||
{
|
|
||||||
test: /\.vue$/,
|
|
||||||
loader: 'vue'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.js$/,
|
|
||||||
loader: 'babel',
|
|
||||||
include: projectRoot,
|
|
||||||
exclude: /node_modules/
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.json$/,
|
|
||||||
loader: 'json'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.html$/,
|
|
||||||
loader: 'vue-html'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
||||||
loader: 'url',
|
loader: 'url-loader',
|
||||||
query: {
|
options: {
|
||||||
limit: 10000,
|
limit: 10000,
|
||||||
name: utils.assetsPath('img/[name].[hash:7].[ext]')
|
name: utils.assetsPath('img/[name].[hash:7].[ext]')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
|
||||||
|
loader: 'url-loader',
|
||||||
|
options: {
|
||||||
|
limit: 10000,
|
||||||
|
name: utils.assetsPath('media/[name].[hash:7].[ext]')
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
||||||
loader: 'url',
|
loader: 'url-loader',
|
||||||
query: {
|
options: {
|
||||||
limit: 10000,
|
limit: 10000,
|
||||||
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
|
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
eslint: {
|
|
||||||
formatter: require('eslint-friendly-formatter')
|
|
||||||
},
|
|
||||||
vue: {
|
|
||||||
loaders: utils.cssLoaders()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-12
@@ -1,9 +1,11 @@
|
|||||||
var config = require('../config')
|
'use strict'
|
||||||
var webpack = require('webpack')
|
const utils = require('./utils')
|
||||||
var merge = require('webpack-merge')
|
const webpack = require('webpack')
|
||||||
var utils = require('./utils')
|
const config = require('../config')
|
||||||
var baseWebpackConfig = require('./webpack.base.conf')
|
const merge = require('webpack-merge')
|
||||||
var HtmlWebpackPlugin = require('html-webpack-plugin')
|
const baseWebpackConfig = require('./webpack.base.conf')
|
||||||
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||||
|
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
|
||||||
|
|
||||||
// add hot-reload related code to entry chunks
|
// add hot-reload related code to entry chunks
|
||||||
Object.keys(baseWebpackConfig.entry).forEach(function (name) {
|
Object.keys(baseWebpackConfig.entry).forEach(function (name) {
|
||||||
@@ -12,23 +14,23 @@ Object.keys(baseWebpackConfig.entry).forEach(function (name) {
|
|||||||
|
|
||||||
module.exports = merge(baseWebpackConfig, {
|
module.exports = merge(baseWebpackConfig, {
|
||||||
module: {
|
module: {
|
||||||
loaders: utils.styleLoaders()
|
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
|
||||||
},
|
},
|
||||||
// eval-source-map is faster for development
|
// cheap-module-eval-source-map is faster for development
|
||||||
devtool: '#eval-source-map',
|
devtool: '#cheap-module-eval-source-map',
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env': config.dev.env
|
'process.env': config.dev.env
|
||||||
}),
|
}),
|
||||||
// https://github.com/glenjamin/webpack-hot-middleware#installation--usage
|
// https://github.com/glenjamin/webpack-hot-middleware#installation--usage
|
||||||
new webpack.optimize.OccurenceOrderPlugin(),
|
|
||||||
new webpack.HotModuleReplacementPlugin(),
|
new webpack.HotModuleReplacementPlugin(),
|
||||||
new webpack.NoErrorsPlugin(),
|
new webpack.NoEmitOnErrorsPlugin(),
|
||||||
// https://github.com/ampedandwired/html-webpack-plugin
|
// https://github.com/ampedandwired/html-webpack-plugin
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
filename: 'index.html',
|
filename: 'index.html',
|
||||||
template: 'index.html',
|
template: 'index.html',
|
||||||
inject: true
|
inject: true
|
||||||
})
|
}),
|
||||||
|
new FriendlyErrorsPlugin()
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|||||||
+118
-23
@@ -1,33 +1,128 @@
|
|||||||
|
'use strict'
|
||||||
|
const path = require('path')
|
||||||
|
const utils = require('./utils')
|
||||||
const webpack = require('webpack')
|
const webpack = require('webpack')
|
||||||
const base = require('./webpack.base.conf')
|
|
||||||
const config = require('../config')
|
const config = require('../config')
|
||||||
var env = process.env.NODE_ENV === 'testing'
|
const merge = require('webpack-merge')
|
||||||
|
const baseWebpackConfig = require('./webpack.base.conf')
|
||||||
|
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||||
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||||
|
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||||
|
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
|
||||||
|
|
||||||
|
const env = process.env.NODE_ENV === 'testing'
|
||||||
? require('../config/test.env')
|
? require('../config/test.env')
|
||||||
: config.build.env
|
: config.build.env
|
||||||
|
|
||||||
base.entry = {
|
const webpackConfig = merge(baseWebpackConfig, {
|
||||||
lib: './src/index.js'
|
module: {
|
||||||
|
rules: utils.styleLoaders({
|
||||||
|
sourceMap: config.build.productionSourceMap,
|
||||||
|
extract: true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
devtool: config.build.productionSourceMap ? '#source-map' : false,
|
||||||
|
output: {
|
||||||
|
path: config.build.assetsRoot,
|
||||||
|
filename: utils.assetsPath('js/[name].[chunkhash].js'),
|
||||||
|
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
// http://vuejs.github.io/vue-loader/en/workflow/production.html
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'process.env': env
|
||||||
|
}),
|
||||||
|
// UglifyJs do not support ES6+, you can also use babel-minify for better treeshaking: https://github.com/babel/minify
|
||||||
|
new webpack.optimize.UglifyJsPlugin({
|
||||||
|
compress: {
|
||||||
|
warnings: false
|
||||||
|
},
|
||||||
|
sourceMap: true
|
||||||
|
}),
|
||||||
|
// extract css into its own file
|
||||||
|
new ExtractTextPlugin({
|
||||||
|
filename: utils.assetsPath('css/[name].[contenthash].css')
|
||||||
|
}),
|
||||||
|
// Compress extracted CSS. We are using this plugin so that possible
|
||||||
|
// duplicated CSS from different components can be deduped.
|
||||||
|
new OptimizeCSSPlugin({
|
||||||
|
cssProcessorOptions: {
|
||||||
|
safe: true
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
// generate dist index.html with correct asset hash for caching.
|
||||||
|
// you can customize output by editing /index.html
|
||||||
|
// see https://github.com/ampedandwired/html-webpack-plugin
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
filename: process.env.NODE_ENV === 'testing'
|
||||||
|
? 'index.html'
|
||||||
|
: config.build.index,
|
||||||
|
template: 'index.html',
|
||||||
|
inject: true,
|
||||||
|
minify: {
|
||||||
|
removeComments: true,
|
||||||
|
collapseWhitespace: true,
|
||||||
|
removeAttributeQuotes: true
|
||||||
|
// more options:
|
||||||
|
// https://github.com/kangax/html-minifier#options-quick-reference
|
||||||
|
},
|
||||||
|
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
|
||||||
|
chunksSortMode: 'dependency'
|
||||||
|
}),
|
||||||
|
// keep module.id stable when vender modules does not change
|
||||||
|
new webpack.HashedModuleIdsPlugin(),
|
||||||
|
// split vendor js into its own file
|
||||||
|
new webpack.optimize.CommonsChunkPlugin({
|
||||||
|
name: 'vendor',
|
||||||
|
minChunks: function (module) {
|
||||||
|
// any required modules inside node_modules are extracted to vendor
|
||||||
|
return (
|
||||||
|
module.resource &&
|
||||||
|
/\.js$/.test(module.resource) &&
|
||||||
|
module.resource.indexOf(
|
||||||
|
path.join(__dirname, '../node_modules')
|
||||||
|
) === 0
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
// extract webpack runtime and module manifest to its own file in order to
|
||||||
|
// prevent vendor hash from being updated whenever app bundle is updated
|
||||||
|
new webpack.optimize.CommonsChunkPlugin({
|
||||||
|
name: 'manifest',
|
||||||
|
chunks: ['vendor']
|
||||||
|
}),
|
||||||
|
// copy custom static assets
|
||||||
|
new CopyWebpackPlugin([
|
||||||
|
{
|
||||||
|
from: path.resolve(__dirname, '../static'),
|
||||||
|
to: config.build.assetsSubDirectory,
|
||||||
|
ignore: ['.*']
|
||||||
|
}
|
||||||
|
])
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
if (config.build.productionGzip) {
|
||||||
|
const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
||||||
|
|
||||||
|
webpackConfig.plugins.push(
|
||||||
|
new CompressionWebpackPlugin({
|
||||||
|
asset: '[path].gz[query]',
|
||||||
|
algorithm: 'gzip',
|
||||||
|
test: new RegExp(
|
||||||
|
'\\.(' +
|
||||||
|
config.build.productionGzipExtensions.join('|') +
|
||||||
|
')$'
|
||||||
|
),
|
||||||
|
threshold: 10240,
|
||||||
|
minRatio: 0.8
|
||||||
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
base.output = {
|
if (config.build.bundleAnalyzerReport) {
|
||||||
path: config.build.assetsRoot,
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
||||||
publicPath: config.build.assetsPublicPath,
|
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
|
||||||
filename: 'vue-chartjs.js',
|
|
||||||
library: 'VueChartJs',
|
|
||||||
libraryTarget: 'umd'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var webpackConfig = Object.assign({}, base)
|
|
||||||
|
|
||||||
webpackConfig.devtool = '#source-map'
|
|
||||||
webpackConfig.plugins = (webpackConfig.plugins || []).concat([
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
'process.env.NODE_ENV': env
|
|
||||||
}),
|
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
|
||||||
compress: { warnings: false }
|
|
||||||
}),
|
|
||||||
new webpack.optimize.OccurenceOrderPlugin(),
|
|
||||||
])
|
|
||||||
|
|
||||||
module.exports = webpackConfig
|
module.exports = webpackConfig
|
||||||
|
|||||||
@@ -1,17 +1,22 @@
|
|||||||
var vue = require('vue-loader')
|
// var vue = require('vue-loader')
|
||||||
var path = require('path')
|
var path = require('path')
|
||||||
var webpack = require("webpack")
|
var webpack = require('webpack')
|
||||||
var ExtractTextPlugin = require("extract-text-webpack-plugin")
|
var ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||||
var projectRoot = path.resolve(__dirname, '../')
|
var projectRoot = path.resolve(__dirname, '../')
|
||||||
var cssLoader = ExtractTextPlugin.extract('style-loader', 'css-loader')
|
var cssLoader = ExtractTextPlugin.extract('style-loader', 'css-loader')
|
||||||
const npmCfg = require('../package.json');
|
const npmCfg = require('../package.json')
|
||||||
|
const vueLoaderConfig = require('./vue-loader.conf')
|
||||||
|
|
||||||
var banner = [
|
var banner = [
|
||||||
npmCfg.name + ' v' + npmCfg.version,
|
npmCfg.name + ' v' + npmCfg.version,
|
||||||
'(c) ' + (new Date().getFullYear()) + ' ' + npmCfg.author,
|
'(c) ' + (new Date().getFullYear()) + ' ' + npmCfg.author,
|
||||||
npmCfg.homepage
|
npmCfg.homepage
|
||||||
].join('\n')
|
].join('\n')
|
||||||
|
|
||||||
|
function resolve (dir) {
|
||||||
|
return path.join(__dirname, '..', dir)
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: {
|
||||||
'vue-chartjs': './src/index.js'
|
'vue-chartjs': './src/index.js'
|
||||||
@@ -22,30 +27,33 @@ module.exports = {
|
|||||||
libraryTarget: 'umd',
|
libraryTarget: 'umd',
|
||||||
umdNamedDefine: true
|
umdNamedDefine: true
|
||||||
},
|
},
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.js', '.vue', '.json'],
|
||||||
|
alias: {
|
||||||
|
'vue$': 'vue/dist/vue.esm.js',
|
||||||
|
'@': resolve('src')
|
||||||
|
}
|
||||||
|
},
|
||||||
module: {
|
module: {
|
||||||
preLoaders: [
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.(js|vue)$/,
|
||||||
|
loader: 'eslint-loader',
|
||||||
|
enforce: 'pre',
|
||||||
|
include: [resolve('src'), resolve('test')],
|
||||||
|
options: {
|
||||||
|
formatter: require('eslint-friendly-formatter')
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
test: /\.vue$/,
|
test: /\.vue$/,
|
||||||
loader: 'eslint',
|
loader: 'vue-loader',
|
||||||
include: projectRoot,
|
options: vueLoaderConfig
|
||||||
exclude: /node_modules/
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
loader: 'eslint',
|
loader: 'babel-loader',
|
||||||
include: projectRoot,
|
include: [resolve('src'), resolve('test')]
|
||||||
exclude: /node_modules/
|
|
||||||
}
|
|
||||||
],
|
|
||||||
loaders: [
|
|
||||||
{
|
|
||||||
test: /\.vue$/,
|
|
||||||
loader: 'vue'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.js$/,
|
|
||||||
exclude: /node_modules/,
|
|
||||||
loader: 'babel'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.css$/,
|
test: /\.css$/,
|
||||||
@@ -53,20 +61,14 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.s[a|c]ss$/,
|
test: /\.s[a|c]ss$/,
|
||||||
loader: ExtractTextPlugin.extract('style-loader','css-loader!sass-loader')
|
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!sass-loader')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.json$/, loader: 'json'
|
test: /\.json$/,
|
||||||
|
loader: 'json-loader'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
eslint: {
|
|
||||||
formatter: require('eslint-friendly-formatter')
|
|
||||||
},
|
|
||||||
babel: {
|
|
||||||
presets: ['es2015'],
|
|
||||||
plugins: ['transform-runtime']
|
|
||||||
},
|
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.BannerPlugin(banner)
|
new webpack.BannerPlugin(banner)
|
||||||
]
|
]
|
||||||
@@ -85,8 +87,6 @@ if (process.env.NODE_ENV === 'production') {
|
|||||||
compress: {
|
compress: {
|
||||||
warnings: false
|
warnings: false
|
||||||
}
|
}
|
||||||
}),
|
})
|
||||||
new webpack.optimize.OccurenceOrderPlugin()
|
|
||||||
// new ExtractTextPlugin('build.css')
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-2
@@ -11,8 +11,7 @@ config.plugins = [
|
|||||||
compress: {
|
compress: {
|
||||||
warnings: false
|
warnings: false
|
||||||
}
|
}
|
||||||
}),
|
})
|
||||||
new webpack.optimize.OccurenceOrderPlugin()
|
|
||||||
]
|
]
|
||||||
|
|
||||||
module.exports = config
|
module.exports = config
|
||||||
|
|||||||
+36
-39
@@ -1,17 +1,20 @@
|
|||||||
var vue = require('vue-loader')
|
|
||||||
var path = require('path')
|
var path = require('path')
|
||||||
var webpack = require("webpack")
|
var webpack = require('webpack')
|
||||||
var ExtractTextPlugin = require("extract-text-webpack-plugin")
|
var ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||||
var projectRoot = path.resolve(__dirname, '../')
|
|
||||||
var cssLoader = ExtractTextPlugin.extract('style-loader', 'css-loader')
|
var cssLoader = ExtractTextPlugin.extract('style-loader', 'css-loader')
|
||||||
const npmCfg = require('../package.json');
|
const npmCfg = require('../package.json')
|
||||||
|
const vueLoaderConfig = require('./vue-loader.conf')
|
||||||
|
|
||||||
var banner = [
|
var banner = [
|
||||||
npmCfg.name + ' v' + npmCfg.version,
|
npmCfg.name + ' v' + npmCfg.version,
|
||||||
'(c) ' + (new Date().getFullYear()) + ' ' + npmCfg.author,
|
'(c) ' + (new Date().getFullYear()) + ' ' + npmCfg.author,
|
||||||
npmCfg.homepage
|
npmCfg.homepage
|
||||||
].join('\n')
|
].join('\n')
|
||||||
|
|
||||||
|
function resolve (dir) {
|
||||||
|
return path.join(__dirname, '..', dir)
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: {
|
||||||
'vue-chartjs': './src/index.js'
|
'vue-chartjs': './src/index.js'
|
||||||
@@ -25,30 +28,33 @@ module.exports = {
|
|||||||
externals: {
|
externals: {
|
||||||
'chart.js': 'chart.js'
|
'chart.js': 'chart.js'
|
||||||
},
|
},
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.js', '.vue', '.json'],
|
||||||
|
alias: {
|
||||||
|
'vue$': 'vue/dist/vue.esm.js',
|
||||||
|
'@': resolve('src')
|
||||||
|
}
|
||||||
|
},
|
||||||
module: {
|
module: {
|
||||||
preLoaders: [
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.(js|vue)$/,
|
||||||
|
loader: 'eslint-loader',
|
||||||
|
enforce: 'pre',
|
||||||
|
include: [resolve('src'), resolve('test')],
|
||||||
|
options: {
|
||||||
|
formatter: require('eslint-friendly-formatter')
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
test: /\.vue$/,
|
test: /\.vue$/,
|
||||||
loader: 'eslint',
|
loader: 'vue-loader',
|
||||||
include: projectRoot,
|
options: vueLoaderConfig
|
||||||
exclude: /node_modules/
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
loader: 'eslint',
|
loader: 'babel-loader',
|
||||||
include: projectRoot,
|
include: [resolve('src'), resolve('test')]
|
||||||
exclude: /node_modules/
|
|
||||||
}
|
|
||||||
],
|
|
||||||
loaders: [
|
|
||||||
{
|
|
||||||
test: /\.vue$/,
|
|
||||||
loader: 'vue'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.js$/,
|
|
||||||
exclude: /node_modules/,
|
|
||||||
loader: 'babel'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.css$/,
|
test: /\.css$/,
|
||||||
@@ -56,27 +62,20 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.s[a|c]ss$/,
|
test: /\.s[a|c]ss$/,
|
||||||
loader: ExtractTextPlugin.extract('style-loader','css-loader!sass-loader')
|
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!sass-loader')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.json$/, loader: 'json'
|
test: /\.json$/,
|
||||||
|
loader: 'json-loader'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
eslint: {
|
|
||||||
formatter: require('eslint-friendly-formatter')
|
|
||||||
},
|
|
||||||
babel: {
|
|
||||||
presets: ['es2015'],
|
|
||||||
plugins: ['transform-runtime']
|
|
||||||
},
|
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.BannerPlugin(banner)
|
new webpack.BannerPlugin(banner)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
|
||||||
delete module.exports.devtool
|
delete module.exports.devtool
|
||||||
module.exports.plugins = [
|
module.exports.plugins = [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
@@ -88,8 +87,6 @@ if (process.env.NODE_ENV === 'production') {
|
|||||||
compress: {
|
compress: {
|
||||||
warnings: false
|
warnings: false
|
||||||
}
|
}
|
||||||
}),
|
})
|
||||||
new webpack.optimize.OccurenceOrderPlugin()
|
|
||||||
// new ExtractTextPlugin('build.css')
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-2
@@ -11,8 +11,7 @@ config.plugins = [
|
|||||||
compress: {
|
compress: {
|
||||||
warnings: false
|
warnings: false
|
||||||
}
|
}
|
||||||
}),
|
})
|
||||||
new webpack.optimize.OccurenceOrderPlugin()
|
|
||||||
]
|
]
|
||||||
|
|
||||||
module.exports = config
|
module.exports = config
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
'use strict'
|
||||||
|
// This is the webpack config used for unit tests.
|
||||||
|
|
||||||
|
const utils = require('./utils')
|
||||||
|
const webpack = require('webpack')
|
||||||
|
const merge = require('webpack-merge')
|
||||||
|
const baseWebpackConfig = require('./webpack.base.conf')
|
||||||
|
|
||||||
|
const webpackConfig = merge(baseWebpackConfig, {
|
||||||
|
// use inline sourcemap for karma-sourcemap-loader
|
||||||
|
module: {
|
||||||
|
rules: utils.styleLoaders()
|
||||||
|
},
|
||||||
|
devtool: '#inline-source-map',
|
||||||
|
resolveLoader: {
|
||||||
|
alias: {
|
||||||
|
// necessary to to make lang="scss" work in test when using vue-loader's ?inject option
|
||||||
|
// see discussion at https://github.com/vuejs/vue-loader/issues/724
|
||||||
|
'scss-loader': 'sass-loader'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'process.env': require('../config/test.env')
|
||||||
|
})
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
// no need for app entry during tests
|
||||||
|
delete webpackConfig.entry
|
||||||
|
|
||||||
|
module.exports = webpackConfig
|
||||||
+3
-2
@@ -1,5 +1,6 @@
|
|||||||
var merge = require('webpack-merge')
|
'use strict'
|
||||||
var prodEnv = require('./prod.env')
|
const merge = require('webpack-merge')
|
||||||
|
const prodEnv = require('./prod.env')
|
||||||
|
|
||||||
module.exports = merge(prodEnv, {
|
module.exports = merge(prodEnv, {
|
||||||
NODE_ENV: '"development"'
|
NODE_ENV: '"development"'
|
||||||
|
|||||||
+29
-8
@@ -1,21 +1,42 @@
|
|||||||
|
|
||||||
|
'use strict'
|
||||||
|
// Template version: 1.1.1
|
||||||
// see http://vuejs-templates.github.io/webpack for documentation.
|
// see http://vuejs-templates.github.io/webpack for documentation.
|
||||||
var path = require('path')
|
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
build: {
|
build: {
|
||||||
env: require('./prod.env'),
|
env: require('./prod.env'),
|
||||||
|
index: path.resolve(__dirname, '../dist/index.html'),
|
||||||
assetsRoot: path.resolve(__dirname, '../dist'),
|
assetsRoot: path.resolve(__dirname, '../dist'),
|
||||||
assetsSubDirectory: '',
|
assetsSubDirectory: 'static',
|
||||||
assetsPublicPath: '/',
|
assetsPublicPath: '/',
|
||||||
productionSourceMap: true,
|
productionSourceMap: true,
|
||||||
|
// Gzip off by default as many popular static hosts such as
|
||||||
|
// Surge or Netlify already gzip all static assets for you.
|
||||||
|
// Before setting to `true`, make sure to:
|
||||||
|
// npm install --save-dev compression-webpack-plugin
|
||||||
|
productionGzip: false,
|
||||||
|
productionGzipExtensions: ['js', 'css'],
|
||||||
|
// Run the build command with an extra argument to
|
||||||
|
// View the bundle analyzer report after build finishes:
|
||||||
|
// `npm run build --report`
|
||||||
|
// Set to `true` or `false` to always turn it on or off
|
||||||
|
bundleAnalyzerReport: process.env.npm_config_report
|
||||||
},
|
},
|
||||||
dev: {
|
dev: {
|
||||||
env: require('./dev.env'),
|
env: require('./dev.env'),
|
||||||
port: 8080,
|
port: process.env.PORT || 8080,
|
||||||
proxyTable: {}
|
autoOpenBrowser: true,
|
||||||
},
|
assetsSubDirectory: 'static',
|
||||||
umd: {
|
assetsPublicPath: '/',
|
||||||
assetsRoot: path.resolve(__dirname, '../umd'),
|
proxyTable: {},
|
||||||
assetsPublicPath: '/'
|
// CSS Sourcemaps off by default because relative paths are "buggy"
|
||||||
|
// with this option, according to the CSS-Loader README
|
||||||
|
// (https://github.com/webpack/css-loader#sourcemaps)
|
||||||
|
// In our experience, they generally work as expected,
|
||||||
|
// just be aware of this issue when enabling this option.
|
||||||
|
cssSourceMap: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
'use strict'
|
||||||
module.exports = {
|
module.exports = {
|
||||||
NODE_ENV: '"production"'
|
NODE_ENV: '"production"'
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -1,5 +1,6 @@
|
|||||||
var merge = require('webpack-merge')
|
'use strict'
|
||||||
var devEnv = require('./dev.env')
|
const merge = require('webpack-merge')
|
||||||
|
const devEnv = require('./dev.env')
|
||||||
|
|
||||||
module.exports = merge(devEnv, {
|
module.exports = merge(devEnv, {
|
||||||
NODE_ENV: '"testing"'
|
NODE_ENV: '"testing"'
|
||||||
|
|||||||
Vendored
+33250
-33123
File diff suppressed because it is too large
Load Diff
Vendored
+1
-13
File diff suppressed because one or more lines are too long
Vendored
+3694
-3619
File diff suppressed because it is too large
Load Diff
Vendored
+1
-2
File diff suppressed because one or more lines are too long
Generated
+10646
File diff suppressed because it is too large
Load Diff
+13
-8
@@ -57,6 +57,7 @@
|
|||||||
"prepublish": "yarn run lint && yarn run test && yarn run build"
|
"prepublish": "yarn run lint && yarn run test && yarn run build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"isparta": "^4.0.0",
|
||||||
"lodash.merge": "^4.6.0"
|
"lodash.merge": "^4.6.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
@@ -66,7 +67,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-cli": "^6.24.1",
|
"babel-cli": "^6.24.1",
|
||||||
"babel-core": "^6.25.0",
|
"babel-core": "^6.25.0",
|
||||||
"babel-loader": "6.4.1",
|
"babel-loader": "7.1.2",
|
||||||
"babel-plugin-transform-object-assign": "^6.22.0",
|
"babel-plugin-transform-object-assign": "^6.22.0",
|
||||||
"babel-plugin-transform-runtime": "^6.23.0",
|
"babel-plugin-transform-runtime": "^6.23.0",
|
||||||
"babel-preset-es2015": "^6.24.1",
|
"babel-preset-es2015": "^6.24.1",
|
||||||
@@ -90,13 +91,13 @@
|
|||||||
"eslint-plugin-standard": "^3.0.1",
|
"eslint-plugin-standard": "^3.0.1",
|
||||||
"eventsource-polyfill": "^0.9.6",
|
"eventsource-polyfill": "^0.9.6",
|
||||||
"express": "^4.15.2",
|
"express": "^4.15.2",
|
||||||
"extract-text-webpack-plugin": "^1.0.1",
|
"extract-text-webpack-plugin": "^3.0.1",
|
||||||
"file-loader": "^0.10.1",
|
"file-loader": "^0.10.1",
|
||||||
|
"friendly-errors-webpack-plugin": "^1.6.1",
|
||||||
"function-bind": "^1.0.2",
|
"function-bind": "^1.0.2",
|
||||||
"html-webpack-plugin": "^2.28.0",
|
"html-webpack-plugin": "^2.28.0",
|
||||||
"http-proxy-middleware": "^0.17.4",
|
"http-proxy-middleware": "^0.17.4",
|
||||||
"inject-loader": "^3.0.0",
|
"inject-loader": "^3.0.0",
|
||||||
"isparta-loader": "^2.0.0",
|
|
||||||
"jasmine-core": "^2.5.2",
|
"jasmine-core": "^2.5.2",
|
||||||
"json-loader": "^0.5.4",
|
"json-loader": "^0.5.4",
|
||||||
"karma": "^1.5.0",
|
"karma": "^1.5.0",
|
||||||
@@ -104,15 +105,18 @@
|
|||||||
"karma-jasmine": "^1.0.2",
|
"karma-jasmine": "^1.0.2",
|
||||||
"karma-mocha": "^1.2.0",
|
"karma-mocha": "^1.2.0",
|
||||||
"karma-phantomjs-launcher": "^1.0.4",
|
"karma-phantomjs-launcher": "^1.0.4",
|
||||||
|
"karma-phantomjs-shim": "^1.4.0",
|
||||||
"karma-sinon-chai": "^1.2.0",
|
"karma-sinon-chai": "^1.2.0",
|
||||||
"karma-sourcemap-loader": "^0.3.7",
|
"karma-sourcemap-loader": "^0.3.7",
|
||||||
"karma-spec-reporter": "0.0.30",
|
"karma-spec-reporter": "0.0.30",
|
||||||
"karma-webpack": "1.8.1",
|
"karma-webpack": "2",
|
||||||
"lolex": "^1.6.0",
|
"lolex": "^1.6.0",
|
||||||
"mocha": "^3.1.0",
|
"mocha": "^3.1.0",
|
||||||
"nightwatch": "^0.9.14",
|
"nightwatch": "^0.9.14",
|
||||||
|
"opn": "^5.1.0",
|
||||||
"ora": "^1.2.0",
|
"ora": "^1.2.0",
|
||||||
"phantomjs-prebuilt": "^2.1.13",
|
"phantomjs-prebuilt": "^2.1.13",
|
||||||
|
"portfinder": "^1.0.13",
|
||||||
"selenium-server": "^3.3.1",
|
"selenium-server": "^3.3.1",
|
||||||
"shelljs": "^0.7.7",
|
"shelljs": "^0.7.7",
|
||||||
"sinon": "^2.1.0",
|
"sinon": "^2.1.0",
|
||||||
@@ -121,16 +125,17 @@
|
|||||||
"vue": "2.5.2",
|
"vue": "2.5.2",
|
||||||
"vue-hot-reload-api": "2.1.0",
|
"vue-hot-reload-api": "2.1.0",
|
||||||
"vue-html-loader": "^1.2.4",
|
"vue-html-loader": "^1.2.4",
|
||||||
"vue-loader": "12.2.2",
|
"vue-loader": "^13.3.0",
|
||||||
"vue-style-loader": "3.0.1",
|
"vue-style-loader": "3.0.1",
|
||||||
"vue-template-compiler": "2.5.2",
|
"vue-template-compiler": "2.5.2",
|
||||||
"webpack": "^1.13.2",
|
"webpack": "^3.7.1",
|
||||||
"webpack-dev-middleware": "^1.10.1",
|
"webpack-dev-middleware": "^1.10.1",
|
||||||
"webpack-hot-middleware": "^2.17.1",
|
"webpack-hot-middleware": "^2.17.1",
|
||||||
"webpack-merge": "1.1.1"
|
"webpack-merge": "^4.1.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0",
|
||||||
|
"npm": ">= 3.0.0"
|
||||||
},
|
},
|
||||||
"babel": {
|
"babel": {
|
||||||
"presets": [
|
"presets": [
|
||||||
|
|||||||
+10
-12
@@ -16,11 +16,6 @@ var webpackConfig = merge(baseConfig, {
|
|||||||
loaders: utils.styleLoaders()
|
loaders: utils.styleLoaders()
|
||||||
},
|
},
|
||||||
devtool: '#inline-source-map',
|
devtool: '#inline-source-map',
|
||||||
vue: {
|
|
||||||
loaders: {
|
|
||||||
js: 'isparta'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env': require('../../config/test.env')
|
'process.env': require('../../config/test.env')
|
||||||
@@ -31,15 +26,18 @@ var webpackConfig = merge(baseConfig, {
|
|||||||
// no need for app entry during tests
|
// no need for app entry during tests
|
||||||
delete webpackConfig.entry
|
delete webpackConfig.entry
|
||||||
|
|
||||||
|
// function resolve (dir) {
|
||||||
|
// return path.join(__dirname, '..', dir)
|
||||||
|
// }
|
||||||
// make sure isparta loader is applied before eslint
|
// make sure isparta loader is applied before eslint
|
||||||
webpackConfig.module.preLoaders = webpackConfig.module.preLoaders || []
|
// webpackConfig.module.rules = webpackConfig.module.rules || []
|
||||||
webpackConfig.module.preLoaders.unshift({
|
// webpackConfig.module.rules.unshift({
|
||||||
test: /\.js$/,
|
// test: /\.js$/,
|
||||||
loader: 'isparta',
|
// loader: 'babel-loader',
|
||||||
include: path.resolve(projectRoot, 'src')
|
// include: [resolve('src'), resolve('test')]
|
||||||
})
|
// })
|
||||||
|
|
||||||
// only apply babel for test files when using isparta
|
// // only apply babel for test files when using isparta
|
||||||
webpackConfig.module.loaders.some(function (loader, i) {
|
webpackConfig.module.loaders.some(function (loader, i) {
|
||||||
if (loader.loader === 'babel') {
|
if (loader.loader === 'babel') {
|
||||||
loader.include = path.resolve(projectRoot, 'test/unit')
|
loader.include = path.resolve(projectRoot, 'test/unit')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import BarChart from 'src/examples/BarExample'
|
import BarChart from '@/examples/BarExample'
|
||||||
|
|
||||||
describe('BarChart', () => {
|
describe('BarChart', () => {
|
||||||
let el
|
let el
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import BubbleChart from 'src/examples/BubbleExample'
|
import BubbleChart from '@/examples/BubbleExample'
|
||||||
|
|
||||||
describe('BubbleChart', () => {
|
describe('BubbleChart', () => {
|
||||||
let el
|
let el
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import DoughnutChart from 'src/examples/DoughnutExample'
|
import DoughnutChart from '@/examples/DoughnutExample'
|
||||||
|
|
||||||
describe('DoughnutChart', () => {
|
describe('DoughnutChart', () => {
|
||||||
let el
|
let el
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import HorizontalBarChart from 'src/examples/HorizontalBarExample'
|
import HorizontalBarChart from '@/examples/HorizontalBarExample'
|
||||||
|
|
||||||
describe('HorizontalBarChart', () => {
|
describe('HorizontalBarChart', () => {
|
||||||
let el
|
let el
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import LineChart from 'src/examples/LineExample'
|
import LineChart from '@/examples/LineExample'
|
||||||
|
|
||||||
describe('LineChart', () => {
|
describe('LineChart', () => {
|
||||||
let el
|
let el
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import PieChart from 'src/examples/PieExample'
|
import PieChart from '@/examples/PieExample'
|
||||||
|
|
||||||
describe('PieChart', () => {
|
describe('PieChart', () => {
|
||||||
let el
|
let el
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import PolarChart from 'src/examples/PolarAreaExample'
|
import PolarChart from '@/examples/PolarAreaExample'
|
||||||
|
|
||||||
describe('PolarChart', () => {
|
describe('PolarChart', () => {
|
||||||
let el
|
let el
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import RadarChart from 'src/examples/RadarExample'
|
import RadarChart from '@/examples/RadarExample'
|
||||||
|
|
||||||
describe('RadarChart', () => {
|
describe('RadarChart', () => {
|
||||||
let el
|
let el
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import ScatterChart from 'src/examples/ScatterExample'
|
import ScatterChart from '@/examples/ScatterExample'
|
||||||
|
|
||||||
describe('ScatterChart', () => {
|
describe('ScatterChart', () => {
|
||||||
let el
|
let el
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { mergeOptions } from 'src/helpers/options'
|
import { mergeOptions } from '@/helpers/options'
|
||||||
|
|
||||||
describe('mergeOptions.js', () => {
|
describe('mergeOptions.js', () => {
|
||||||
const a = {
|
const a = {
|
||||||
|
|||||||
Reference in New Issue
Block a user