Skip to content

Commit

Permalink
rebuild webpack config
Browse files Browse the repository at this point in the history
  • Loading branch information
zollero committed Sep 15, 2017
1 parent fbcffb2 commit 4081c96
Show file tree
Hide file tree
Showing 23 changed files with 631 additions and 223 deletions.
46 changes: 19 additions & 27 deletions build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,31 @@ require('./check-versions')()
const NODE_ENV = process.env.NODE_ENV = process.env.NODE_ENV || 'production'

var ora = require('ora')
var rm = require('rimraf')
var path = require('path')
var chalk = require('chalk')
var webpack = require('webpack')
var config = require('../config')
var webpackConfig = NODE_ENV === 'production'
? require('./webpack.prod.conf')
: require('./webpack.dev.conf')
var exec = require('child_process').exec
var spinner = ora('building for '+ NODE_ENV +'...')
var webpackConfig = require('./webpack.prod.conf')
var spinner = ora('Start building ...')

spinner.start()

var buildStyleScript = require('../package.json').scripts['theme']
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
const compiler = webpack(webpackConfig)

compiler.watch({}, function (err, stats) {
spinner.stop()
if (err) throw err
exec(buildStyleScript, function (err){
if (err) throw err
webpack(webpackConfig, function (err, stats) {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false,
chunks: false,
chunkModules: false
}) + '\n\n')
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false,
chunks: false,
chunkModules: false
}) + '\n\n')

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'
))
})
})
console.log(chalk.cyan(' Build complete.\n'))
console.log(chalk.yellow(
' ' + new Date()
))
})

2 changes: 1 addition & 1 deletion build/check-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var versionRequirements = [
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
},
}
]

if (shell.which('npm')) {
Expand Down
9 changes: 0 additions & 9 deletions build/dev-client.js

This file was deleted.

95 changes: 0 additions & 95 deletions build/dev-server.js

This file was deleted.

19 changes: 0 additions & 19 deletions build/vue-loader.conf.js

This file was deleted.

2 changes: 1 addition & 1 deletion build/webpack.base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var path = require('path')
var utils = require('./utils')
var config = require('../config')
var vueLoaderConfig = require('./vue-loader.conf')
// var vueLoaderConfig = require('./vue-loader.conf')

function resolve (dir) {
return path.join(__dirname, '..', dir)
Expand Down
42 changes: 0 additions & 42 deletions build/webpack.dev.conf.js

This file was deleted.

5 changes: 3 additions & 2 deletions build/webpack.prod.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ var CopyWebpackPlugin = require('copy-webpack-plugin')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
var vueLoaderConfig = require('./vue-loader.conf')

var env = config.build.env

Expand All @@ -21,7 +20,9 @@ var webpackConfig = merge(baseWebpackConfig, {
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig({sourceMap: true, extract: true})
options: {
loaders: utils.cssLoaders({sourceMap: true, extract: true})
}
}
)
},
Expand Down
4 changes: 2 additions & 2 deletions config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
index: path.resolve(__dirname, '../dist/index.html'),
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/',
assetsPublicPath: './',
productionSourceMap: true,
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
Expand All @@ -27,7 +27,7 @@ module.exports = {
port: 8100,
autoOpenBrowser: true,
assetsSubDirectory: 'static',
assetsPublicPath: '/',
assetsPublicPath: './',
// proxyTable: require('../proxy'),
// CSS Sourcemaps off by default because relative paths are "buggy"
// with this option, according to the CSS-Loader README
Expand Down
3 changes: 0 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
<title>Todo List</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" href="./css/animate.min.css" />
<link rel="stylesheet" href="./css/iconfont.css" />
<link rel="stylesheet" href="./css/popup.css" />
</head>
<body>
<div id="app"></div>
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Todo",
"version": "0.0.1",
"version": "0.0.2",
"manifest_version": 2,
"description": "An extension to manage todo list.",
"icons": {
Expand All @@ -14,7 +14,7 @@
"38": "images/normal38.png"
},
"default_title": "Todo List",
"default_popup": "popup.html"
"default_popup": "./dist/index.html"
},
"permissions": [
"tabs",
Expand Down
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@
"lib": "lib"
},
"scripts": {
"dev": "node build/dev-server.js",
"dev:mock": "npm run dev mock",
"start": "node build/dev-server.js",
"build": "node build/build.js",
"build:debug": "cross-env NODE_ENV=development npm run build",
"build:publish": "cross-env NODE_ENV=production npm run build"
"build": "node build/build.js"
},
"repository": {
"type": "git",
Expand Down
12 changes: 0 additions & 12 deletions src/App.vue

This file was deleted.

Loading

0 comments on commit 4081c96

Please sign in to comment.