webpack upgrade

This commit is contained in:
daniel-j 2016-11-21 13:57:05 +01:00
parent b2717c6ee3
commit c2234018d7
4 changed files with 29 additions and 34 deletions

View file

@ -33,21 +33,20 @@ webpackConfig.forEach((c) => {
minimize: true,
debug: false
}))
c.plugins.push(new webpack.optimize.DedupePlugin())
if (c.uglify) {
c.plugins.push(new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
screw_ie8: true
},
comments: false,
mangle: {
screw_ie8: true
},
screw_ie8: true,
sourceMap: !!c.devtool
}))
}
/*
c.plugins.push(new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
screw_ie8: true
},
comments: false,
mangle: {
screw_ie8: true
},
screw_ie8: true,
sourceMap: !!c.devtool
}))
*/
}
c.plugins.push(new webpack.DefinePlugin({
FIMFIC2EPUB_VERSION: JSON.stringify(require('./package.json').version)

View file

@ -9,7 +9,7 @@ import isNode from 'detect-node'
let tidy
if (!isNode) {
tidy = require('exports?tidy_html5!tidy-html5')
tidy = require('exports-loader?tidy_html5!tidy-html5')
} else {
tidy = require('tidy-html5').tidy_html5
}

View file

@ -1,5 +1,5 @@
export let NS = {
export const NS = {
OPF: 'http://www.idpf.org/2007/opf',
OPS: 'http://www.idpf.org/2007/ops',
DC: 'http://purl.org/dc/elements/1.1/',
@ -9,7 +9,7 @@ export let NS = {
XLINK: 'http://www.w3.org/1999/xlink'
}
export let tidyOptions = {
export const tidyOptions = {
'indent': 'auto',
'numeric-entities': 'yes',
'output-xhtml': 'yes',
@ -22,11 +22,11 @@ export let tidyOptions = {
'show-body-only': 'auto'
}
export let containerXml = `<?xml version="1.0" encoding="UTF-8"?>
export const containerXml = `<?xml version="1.0" encoding="UTF-8"?>
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<rootfiles>
<rootfile full-path="OEBPS/content.opf" media-type="application/oebps-package+xml"/>
</rootfiles>
</container>
`
export let youtubeKey = 'AIzaSyCF1taix0lTr7-e_XBZazIXfAr8IvxTJhA'
export const youtubeKey = 'AIzaSyCF1taix0lTr7-e_XBZazIXfAr8IvxTJhA'

View file

@ -16,10 +16,10 @@ const bundleExtensionConfig = {
},
module: {
loaders: [
rules: [
{
test: /\.js$/,
loader: 'babel',
use: 'babel-loader',
exclude: /node_modules/,
query: {
sourceMaps: true,
@ -28,7 +28,7 @@ const bundleExtensionConfig = {
},
{
test: /\.styl$/,
loader: 'raw-loader!stylus-loader'
use: ['raw-loader', 'stylus-loader']
}
],
noParse: [
@ -37,7 +37,7 @@ const bundleExtensionConfig = {
},
resolve: {
extensions: ['', '.js', '.json', '.styl'],
extensions: ['.js', '.json', '.styl'],
modules: [
path.resolve('./src'),
'node_modules'
@ -50,9 +50,7 @@ const bundleExtensionConfig = {
externals: ['request', 'tidy-html5'],
plugins: [],
devtool: 'source-map',
debug: true,
uglify: inProduction
devtool: 'source-map'
}
const bundleNpmModuleConfig = {
@ -67,10 +65,10 @@ const bundleNpmModuleConfig = {
target: 'node',
module: {
loaders: [
rules: [
{
test: /\.js$/,
loader: 'babel',
use: 'babel-loader',
exclude: /node_modules/,
query: {
sourceMaps: !inProduction,
@ -79,7 +77,7 @@ const bundleNpmModuleConfig = {
},
{
test: /\.styl$/,
loader: 'raw-loader!stylus-loader'
use: ['raw-loader', 'stylus-loader']
}
],
noParse: [
@ -88,7 +86,7 @@ const bundleNpmModuleConfig = {
},
resolve: {
extensions: ['', '.js', '.json', '.styl'],
extensions: ['.js', '.json', '.styl'],
modules: [
path.resolve('./src'),
'node_modules'
@ -98,9 +96,7 @@ const bundleNpmModuleConfig = {
externals: [nodeExternals({whitelist: ['es6-event-emitter', /^babel-runtime/]}), 'exports?tidy_html5!tidy-html5'],
plugins: [],
devtool: 'source-map',
debug: true,
uglify: inProduction
devtool: 'source-map'
}
export default [bundleExtensionConfig, bundleNpmModuleConfig]