From 75310cd8cbf57ff8529ce7485f16449d64dc0017 Mon Sep 17 00:00:00 2001 From: haoliangyu Date: Tue, 2 May 2017 21:12:20 -0400 Subject: [PATCH] use html-load instead of raw-loader --- package.json | 2 +- webpack/webpack.config.dev.js | 2 +- webpack/webpack.config.prod.js | 2 +- yarn.lock | 50 ++++++++++++++++++++++++++++++---- 4 files changed, 47 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index ecdbca3..ff98355 100755 --- a/package.json +++ b/package.json @@ -47,12 +47,12 @@ "css-loader": "^0.28.0", "extract-text-webpack-plugin": "^2.1.0", "file-loader": "^0.11.1", + "html-loader": "^0.4.5", "html-webpack-plugin": "^2.28.0", "less": "^2.7.2", "less-loader": "^4.0.3", "optimize-css-assets-webpack-plugin": "^1.3.0", "optimize-js-plugin": "0.0.4", - "raw-loader": "^0.5.1", "script-ext-html-webpack-plugin": "^1.7.1", "style-loader": "^0.16.1", "to-string-loader": "^1.1.5", diff --git a/webpack/webpack.config.dev.js b/webpack/webpack.config.dev.js index ef51737..1ff35b5 100644 --- a/webpack/webpack.config.dev.js +++ b/webpack/webpack.config.dev.js @@ -27,7 +27,7 @@ module.exports = { rules: [ { test: /\.ts$/, enforce: 'pre', loader: 'tslint-loader' }, { test: /(\.component|\.service|)\.ts$/, use: ['ts-loader'] }, - { test: /\.component\.html$/, use: ['raw-loader'] }, + { test: /\.html$/, use: [{ loader: 'html-loader', options: { minimize: false } }] }, { test: /(\.component|)\.less$/, use: ['to-string-loader', 'css-loader', 'less-loader'] }, { test: /\.css$/, use: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' })}, { test: /\.(png|gif|jpg)$/, use:[{ loader: 'file-loader', options: { name: 'images/[name].[ext]'} } ]}, diff --git a/webpack/webpack.config.prod.js b/webpack/webpack.config.prod.js index 4c54d79..44140e2 100644 --- a/webpack/webpack.config.prod.js +++ b/webpack/webpack.config.prod.js @@ -29,7 +29,7 @@ module.exports = { rules: [ { test: /\.ts$/, enforce: 'pre', loader: 'tslint-loader' }, { test: /(\.component|\.service|)\.ts$/, use: ['ts-loader'] }, - { test: /\.component\.html$/, use: ['raw-loader'] }, + { test: /\.html$/, use: [{ loader: 'html-loader', options: { minimize: false } }] }, { test: /(\.component|)\.less$/, use: ['to-string-loader', 'css-loader', 'less-loader'] }, { test: /\.css$/, use: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' })}, { test: /\.(png|gif|jpg)$/, use:[{ loader: 'file-loader', options: { name: 'images/[name].[ext]'} } ]}, diff --git a/yarn.lock b/yarn.lock index cad5fb4..4e6fc2f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -165,6 +165,10 @@ assert@^1.1.1: dependencies: util "0.10.3" +ast-types@0.9.6: + version "0.9.6" + resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.6.tgz#102c9e9e9005d3e7e3829bf0c4fa24ee862ee9b9" + async-each@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" @@ -858,6 +862,13 @@ error-ex@^1.2.0: dependencies: is-arrayish "^0.2.1" +es6-templates@^0.2.2: + version "0.2.3" + resolved "https://registry.yarnpkg.com/es6-templates/-/es6-templates-0.2.3.tgz#5cb9ac9fb1ded6eb1239342b81d792bbb4078ee4" + dependencies: + recast "~0.11.12" + through "~2.3.6" + escape-string-regexp@^1.0.2: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -866,6 +877,10 @@ esprima@^2.6.0: version "2.7.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" +esprima@~3.1.0: + version "3.1.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" + estree-walker@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.3.0.tgz#f67ca8f57b9ed66d886af816c099c779b315d4db" @@ -1162,7 +1177,17 @@ html-comment-regex@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/html-comment-regex/-/html-comment-regex-1.1.1.tgz#668b93776eaae55ebde8f3ad464b307a4963625e" -html-minifier@^3.2.3: +html-loader@^0.4.5: + version "0.4.5" + resolved "https://registry.yarnpkg.com/html-loader/-/html-loader-0.4.5.tgz#5fbcd87cd63a5c49a7fce2fe56f425e05729c68c" + dependencies: + es6-templates "^0.2.2" + fastparse "^1.1.1" + html-minifier "^3.0.1" + loader-utils "^1.0.2" + object-assign "^4.1.0" + +html-minifier@^3.0.1, html-minifier@^3.2.3: version "3.3.0" resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.3.0.tgz#a9b5b8eda501362d4c5699db02a8dc72013d1fab" dependencies: @@ -2193,6 +2218,10 @@ pretty-error@^2.0.2: renderkid "~2.0.0" utila "~0.4" +private@~0.1.5: + version "0.1.7" + resolved "https://registry.yarnpkg.com/private/-/private-0.1.7.tgz#68ce5e8a1ef0a23bb570cc28537b5332aba63ef1" + process-nextick-args@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" @@ -2267,10 +2296,6 @@ randombytes@^2.0.0, randombytes@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.0.3.tgz#674c99760901c3c4112771a31e521dc349cc09ec" -raw-loader@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-0.5.1.tgz#0c3d0beaed8a01c966d9787bf778281252a979aa" - rc@~1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/rc/-/rc-1.1.6.tgz#43651b76b6ae53b5c802f1151fa3fc3b059969c9" @@ -2337,6 +2362,15 @@ readdirp@^2.0.0: readable-stream "^2.0.2" set-immediate-shim "^1.0.1" +recast@~0.11.12: + version "0.11.23" + resolved "https://registry.yarnpkg.com/recast/-/recast-0.11.23.tgz#451fd3004ab1e4df9b4e4b66376b2a21912462d3" + dependencies: + ast-types "0.9.6" + esprima "~3.1.0" + private "~0.1.5" + source-map "~0.5.0" + rechoir@^0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" @@ -2547,7 +2581,7 @@ source-list-map@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-1.1.1.tgz#1a33ac210ca144d1e561f906ebccab5669ff4cb4" -source-map@0.5.x, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.3: +source-map@0.5.x, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.0, source-map@~0.5.1, source-map@~0.5.3: version "0.5.6" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" @@ -2698,6 +2732,10 @@ tar@~2.2.1: fstream "^1.0.2" inherits "2" +through@~2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + timers-browserify@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.2.tgz#ab4883cf597dcd50af211349a00fbca56ac86b86"