Commit c173b9a5 by hanjixin

change

parent 033d3689
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
"chai": "^4.1.2", "chai": "^4.1.2",
"eslint": "^5.16.0", "eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0", "eslint-plugin-vue": "^5.0.0",
"html-webpack-plugin": "^4.0.0-beta.5",
"lint-staged": "^8.1.5", "lint-staged": "^8.1.5",
"node-sass": "^4.9.0", "node-sass": "^4.9.0",
"sass-loader": "^7.1.0", "sass-loader": "^7.1.0",
......
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
console.log(HtmlWebpackPlugin)
class InlineSourcePlugin { class InlineSourcePlugin {
constructor(match) { constructor(match) {
this.reg = match this.reg = match
} }
processTags(data, compilation) { processTags(data, compilation) {
// 处理标签 // 处理标签
console.log(data.headTags, data.bodyTags)
let headTags = []; let headTags = [];
let bodyTags = []; let bodyTags = [];
data.headTags.forEach(headTag => { data.headTags.forEach(headTag => {
...@@ -17,6 +19,7 @@ class InlineSourcePlugin { ...@@ -17,6 +19,7 @@ class InlineSourcePlugin {
} }
processTag(tag, compilation) { processTag(tag, compilation) {
let newTag, url; let newTag, url;
console.log(tag, 'tag')
if(tag.tagName === 'link' && this.reg.test(tag.attributes.href) ) { if(tag.tagName === 'link' && this.reg.test(tag.attributes.href) ) {
newTag = { newTag = {
tagName: 'style', tagName: 'style',
......
...@@ -66,7 +66,7 @@ module.exports = { ...@@ -66,7 +66,7 @@ module.exports = {
// return args; // return args;
// }); // });
// } // }
console.log(Object.values(config.module.rules)[1]) // console.log(Object.values(config.module.rules)[1])
}, },
configureWebpack: config => { configureWebpack: config => {
if (isProduction) { if (isProduction) {
...@@ -99,6 +99,10 @@ module.exports = { ...@@ -99,6 +99,10 @@ module.exports = {
config.plugins.push(new InlineSourcePlugin({ config.plugins.push(new InlineSourcePlugin({
match: /\.(js|css)/ match: /\.(js|css)/
})) }))
// config.plugins.push(new HtmlWebpackPlugin({
// // filename: 'index.html'
// template: './public/index.html'
// }))
} else { } else {
// 为开发环境修改配置... // 为开发环境修改配置...
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment