Experimental webpack 2

html-webpack-plugin chunks be changed to alphabetic order
This commit is contained in:
Yukai Huang 2017-02-19 15:45:27 +08:00
parent cd91f237ab
commit 401cef8fb3
6 changed files with 94 additions and 95 deletions

View file

@ -155,9 +155,9 @@
"eslint": "^3.15.0", "eslint": "^3.15.0",
"exports-loader": "^0.6.3", "exports-loader": "^0.6.3",
"expose-loader": "^0.7.1", "expose-loader": "^0.7.1",
"extract-text-webpack-plugin": "^1.0.1", "extract-text-webpack-plugin": "^2.0.0-rc.3",
"file-loader": "^0.9.0", "file-loader": "^0.9.0",
"html-webpack-plugin": "^2.25.0", "html-webpack-plugin": "^2.28.0",
"imports-loader": "^0.7.0", "imports-loader": "^0.7.0",
"json-loader": "^0.5.4", "json-loader": "^0.5.4",
"less": "^2.7.1", "less": "^2.7.1",
@ -166,7 +166,7 @@
"script-loader": "^0.7.0", "script-loader": "^0.7.0",
"style-loader": "^0.13.1", "style-loader": "^0.13.1",
"url-loader": "^0.5.7", "url-loader": "^0.5.7",
"webpack": "^1.14.0", "webpack": "^2.2.1",
"webpack-parallel-uglify-plugin": "^0.2.0" "webpack-parallel-uglify-plugin": "^0.2.0"
} }
} }

View file

@ -1,3 +1,3 @@
<% for (var css in htmlWebpackPlugin.files.css) { %> <% for (var css in htmlWebpackPlugin.files.css) { %>
<link href="<%= webpackConfig.output.baseUrl %><%= htmlWebpackPlugin.files.css[css] %>" rel="stylesheet"> <link href="<%='\<\%- url \%\>'%><%= htmlWebpackPlugin.files.css[css] %>" rel="stylesheet">
<% } %> <% } %>

View file

@ -1,3 +1,3 @@
<% for (var chunk in htmlWebpackPlugin.files.chunks) { %> <% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
<script src="<%= webpackConfig.output.baseUrl %><%= htmlWebpackPlugin.files.chunks[chunk].entry %>" defer></script> <script src="<%= '\<\%- url \%\>' %><%= htmlWebpackPlugin.files.chunks[chunk].entry %>" defer></script>
<% } %> <% } %>

View file

@ -13,13 +13,13 @@ module.exports = [Object.assign({}, baseConfig, {
module: { module: {
loaders: [{ loaders: [{
test: /\.css$/, test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader') loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' })
}, { }, {
test: /\.scss$/, test: /\.scss$/,
loader: ExtractTextPlugin.extract('style-loader', 'sass-loader') loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'sass-loader' })
}, { }, {
test: /\.less$/, test: /\.less$/,
loader: ExtractTextPlugin.extract('style-loader', 'less-loader') loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'less-loader' })
}] }]
}, },
output: { output: {

View file

@ -37,13 +37,13 @@ module.exports = [Object.assign({}, baseConfig, {
module: { module: {
loaders: [{ loaders: [{
test: /\.css$/, test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader') loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' })
}, { }, {
test: /\.scss$/, test: /\.scss$/,
loader: ExtractTextPlugin.extract('style-loader', 'sass-loader') loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'sass-loader' })
}, { }, {
test: /\.less$/, test: /\.less$/,
loader: ExtractTextPlugin.extract('style-loader', 'less-loader') loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'less-loader' })
}] }]
}, },
output: { output: {

View file

@ -169,9 +169,9 @@ module.exports = {
font: path.join(__dirname, 'public/css/google-font.css'), font: path.join(__dirname, 'public/css/google-font.css'),
"font-pack": path.join(__dirname, 'public/css/font.css'), "font-pack": path.join(__dirname, 'public/css/font.css'),
common: [ common: [
"expose?jQuery!expose?$!jquery", "expose-loader?jQuery!expose-loader?$!jquery",
"velocity-animate", "velocity-animate",
"imports?$=jquery!jquery-mousewheel", "imports-loader?$=jquery!jquery-mousewheel",
"bootstrap" "bootstrap"
], ],
cover: [ cover: [
@ -188,28 +188,28 @@ module.exports = {
"cover-pack": [ "cover-pack": [
"babel-polyfill", "babel-polyfill",
"bootstrap-validator", "bootstrap-validator",
"script!listPagnation", "script-loader!listPagnation",
"expose?select2!select2", "expose-loader?select2!select2",
"expose?moment!moment", "expose-loader?moment!moment",
"script!js-url", "script-loader!js-url",
path.join(__dirname, 'public/js/cover.js') path.join(__dirname, 'public/js/cover.js')
], ],
index: [ index: [
"babel-polyfill", "babel-polyfill",
"script!jquery-ui-resizable", "script-loader!jquery-ui-resizable",
"script!js-url", "script-loader!js-url",
"expose?filterXSS!xss", "expose-loader?filterXSS!xss",
"script!Idle.Js", "script-loader!Idle.Js",
"expose?LZString!lz-string", "expose-loader?LZString!lz-string",
"script!codemirror", "script-loader!codemirror",
"script!inlineAttachment", "script-loader!inlineAttachment",
"script!jqueryTextcomplete", "script-loader!jqueryTextcomplete",
"script!codemirrorSpellChecker", "script-loader!codemirrorSpellChecker",
"script!codemirrorInlineAttachment", "script-loader!codemirrorInlineAttachment",
"script!ot", "script-loader!ot",
"flowchart.js", "flowchart.js",
"js-sequence-diagrams", "js-sequence-diagrams",
"expose?RevealMarkdown!reveal-markdown", "expose-loader?RevealMarkdown!reveal-markdown",
path.join(__dirname, 'public/js/google-drive-upload.js'), path.join(__dirname, 'public/js/google-drive-upload.js'),
path.join(__dirname, 'public/js/google-drive-picker.js'), path.join(__dirname, 'public/js/google-drive-picker.js'),
path.join(__dirname, 'public/js/index.js') path.join(__dirname, 'public/js/index.js')
@ -242,41 +242,41 @@ module.exports = {
], ],
"index-pack": [ "index-pack": [
"babel-polyfill", "babel-polyfill",
"expose?Spinner!spin.js", "expose-loader?Spinner!spin.js",
"script!jquery-ui-resizable", "script-loader!jquery-ui-resizable",
"bootstrap-validator", "bootstrap-validator",
"expose?jsyaml!js-yaml", "expose-loader?jsyaml!js-yaml",
"script!mermaid", "script-loader!mermaid",
"expose?moment!moment", "expose-loader?moment!moment",
"script!js-url", "script-loader!js-url",
"script!handlebars", "script-loader!handlebars",
"expose?hljs!highlight.js", "expose-loader?hljs!highlight.js",
"expose?emojify!emojify.js", "expose-loader?emojify!emojify.js",
"expose?filterXSS!xss", "expose-loader?filterXSS!xss",
"script!Idle.Js", "script-loader!Idle.Js",
"script!gist-embed", "script-loader!gist-embed",
"expose?LZString!lz-string", "expose-loader?LZString!lz-string",
"script!codemirror", "script-loader!codemirror",
"script!inlineAttachment", "script-loader!inlineAttachment",
"script!jqueryTextcomplete", "script-loader!jqueryTextcomplete",
"script!codemirrorSpellChecker", "script-loader!codemirrorSpellChecker",
"script!codemirrorInlineAttachment", "script-loader!codemirrorInlineAttachment",
"script!ot", "script-loader!ot",
"flowchart.js", "flowchart.js",
"js-sequence-diagrams", "js-sequence-diagrams",
"expose?Viz!viz.js", "expose-loader?Viz!viz.js",
"expose?io!socket.io-client", "expose-loader?io!socket.io-client",
"expose?RevealMarkdown!reveal-markdown", "expose-loader?RevealMarkdown!reveal-markdown",
path.join(__dirname, 'public/js/google-drive-upload.js'), path.join(__dirname, 'public/js/google-drive-upload.js'),
path.join(__dirname, 'public/js/google-drive-picker.js'), path.join(__dirname, 'public/js/google-drive-picker.js'),
path.join(__dirname, 'public/js/index.js') path.join(__dirname, 'public/js/index.js')
], ],
pretty: [ pretty: [
"babel-polyfill", "babel-polyfill",
"expose?filterXSS!xss", "expose-loader?filterXSS!xss",
"flowchart.js", "flowchart.js",
"js-sequence-diagrams", "js-sequence-diagrams",
"expose?RevealMarkdown!reveal-markdown", "expose-loader?RevealMarkdown!reveal-markdown",
path.join(__dirname, 'public/js/pretty.js') path.join(__dirname, 'public/js/pretty.js')
], ],
"pretty-styles": [ "pretty-styles": [
@ -293,27 +293,27 @@ module.exports = {
], ],
"pretty-pack": [ "pretty-pack": [
"babel-polyfill", "babel-polyfill",
"expose?jsyaml!js-yaml", "expose-loader?jsyaml!js-yaml",
"script!mermaid", "script-loader!mermaid",
"expose?moment!moment", "expose-loader?moment!moment",
"script!handlebars", "script-loader!handlebars",
"expose?hljs!highlight.js", "expose-loader?hljs!highlight.js",
"expose?emojify!emojify.js", "expose-loader?emojify!emojify.js",
"expose?filterXSS!xss", "expose-loader?filterXSS!xss",
"script!gist-embed", "script-loader!gist-embed",
"flowchart.js", "flowchart.js",
"js-sequence-diagrams", "js-sequence-diagrams",
"expose?Viz!viz.js", "expose-loader?Viz!viz.js",
"expose?RevealMarkdown!reveal-markdown", "expose-loader?RevealMarkdown!reveal-markdown",
path.join(__dirname, 'public/js/pretty.js') path.join(__dirname, 'public/js/pretty.js')
], ],
slide: [ slide: [
"babel-polyfill", "babel-polyfill",
"bootstrap-tooltip", "bootstrap-tooltip",
"expose?filterXSS!xss", "expose-loader?filterXSS!xss",
"flowchart.js", "flowchart.js",
"js-sequence-diagrams", "js-sequence-diagrams",
"expose?RevealMarkdown!reveal-markdown", "expose-loader?RevealMarkdown!reveal-markdown",
path.join(__dirname, 'public/js/slide.js') path.join(__dirname, 'public/js/slide.js')
], ],
"slide-styles": [ "slide-styles": [
@ -329,24 +329,24 @@ module.exports = {
], ],
"slide-pack": [ "slide-pack": [
"babel-polyfill", "babel-polyfill",
"expose?jQuery!expose?$!jquery", "expose-loader?jQuery!expose-loader?$!jquery",
"velocity-animate", "velocity-animate",
"imports?$=jquery!jquery-mousewheel", "imports-loader?$=jquery!jquery-mousewheel",
"bootstrap-tooltip", "bootstrap-tooltip",
"expose?jsyaml!js-yaml", "expose-loader?jsyaml!js-yaml",
"script!mermaid", "script-loader!mermaid",
"expose?moment!moment", "expose-loader?moment!moment",
"script!handlebars", "script-loader!handlebars",
"expose?hljs!highlight.js", "expose-loader?hljs!highlight.js",
"expose?emojify!emojify.js", "expose-loader?emojify!emojify.js",
"expose?filterXSS!xss", "expose-loader?filterXSS!xss",
"script!gist-embed", "script-loader!gist-embed",
"flowchart.js", "flowchart.js",
"js-sequence-diagrams", "js-sequence-diagrams",
"expose?Viz!viz.js", "expose-loader?Viz!viz.js",
"headjs", "headjs",
"expose?Reveal!reveal.js", "expose-loader?Reveal!reveal.js",
"expose?RevealMarkdown!reveal-markdown", "expose-loader?RevealMarkdown!reveal-markdown",
path.join(__dirname, 'public/js/slide.js') path.join(__dirname, 'public/js/slide.js')
] ]
}, },
@ -354,16 +354,15 @@ module.exports = {
output: { output: {
path: path.join(__dirname, 'public/build'), path: path.join(__dirname, 'public/build'),
publicPath: '/build/', publicPath: '/build/',
filename: '[name].js', filename: '[name].js'
baseUrl: '<%- url %>'
}, },
resolve: { resolve: {
modulesDirectories: [ modules: [
path.resolve(__dirname, 'src'), path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'node_modules') path.resolve(__dirname, 'node_modules')
], ],
extensions: ["", ".js"], extensions: [".js"],
alias: { alias: {
codemirror: path.join(__dirname, 'node_modules/codemirror/codemirror.min.js'), codemirror: path.join(__dirname, 'node_modules/codemirror/codemirror.min.js'),
inlineAttachment: path.join(__dirname, 'public/vendor/inlineAttachment/inline-attachment.js'), inlineAttachment: path.join(__dirname, 'public/vendor/inlineAttachment/inline-attachment.js'),
@ -394,43 +393,43 @@ module.exports = {
}, },
module: { module: {
loaders: [{ rules: [{
test: /\.json$/, test: /\.json$/,
loader: 'json-loader' loader: 'json-loader'
}, { }, {
test: /\.js$/, test: /\.js$/,
loader: 'babel', loader: 'babel-loader',
exclude: [/node_modules/, /public\/vendor/] exclude: [/node_modules/, /public\/vendor/]
}, { }, {
test: /\.css$/, test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader') loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' })
}, { }, {
test: /\.scss$/, test: /\.scss$/,
loader: ExtractTextPlugin.extract('style-loader', 'sass-loader') loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'sass-loader' })
}, { }, {
test: /\.less$/, test: /\.less$/,
loader: ExtractTextPlugin.extract('style-loader', 'less-loader') loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'less-loader' })
}, { }, {
test: require.resolve("js-sequence-diagrams"), test: require.resolve("js-sequence-diagrams"),
loader: "imports?Raphael=raphael" loader: "imports-loader?Raphael=raphael"
}, { }, {
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: "file" loader: "file-loader"
}, { }, {
test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?prefix=font/&limit=5000" loader: "url-loader?prefix=font/&limit=5000"
}, { }, {
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&mimetype=application/octet-stream" loader: "url-loader?limit=10000&mimetype=application/octet-stream"
}, { }, {
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&mimetype=image/svg+xml" loader: "url-loader?limit=10000&mimetype=image/svg+xml"
}, { }, {
test: /\.png(\?v=\d+\.\d+\.\d+)?$/, test: /\.png(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&mimetype=image/png" loader: "url-loader?limit=10000&mimetype=image/png"
}, { }, {
test: /\.gif(\?v=\d+\.\d+\.\d+)?$/, test: /\.gif(\?v=\d+\.\d+\.\d+)?$/,
loader: "url?limit=10000&mimetype=image/gif" loader: "url-loader?limit=10000&mimetype=image/gif"
}] }]
}, },