{
test: /\.css$/,
exclude: /node_modules/,
use: ["style-loader", {loader: "css-loader",options: {importLoaders: 1}}, {
loader: "postcss-loader", options: {ident: "postcss",plugins: (loader) => [require("autoprefixer")()]}
}]
}
test: /\.css$/,
exclude: /node_modules/,
use: ["style-loader", {loader: "css-loader",options: {importLoaders: 1}}, {
loader: "postcss-loader", options: {ident: "postcss",plugins: (loader) => [require("autoprefixer")()]}
}]
}
2018-01-25
babel-preset-latest 和 babel-preset-env 恒等 , 效果一样!官网有写。。。
2018-01-25
module: {
rules: [{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ["latest"]
}
}
}]
}
// npm install babel-preset-latest
rules: [{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ["latest"]
}
}
}]
}
// npm install babel-preset-latest
2018-01-25
module: {
rules: [{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ["env"]
}
}
}]
}
// npm install babel-preset-env
rules: [{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ["env"]
}
}
}]
}
// npm install babel-preset-env
2018-01-25
minify: {
removeComments: true,
collapseWhitespace: true,
minifyJS: true
}
removeComments: true,
collapseWhitespace: true,
minifyJS: true
}
2018-01-25
官网上这个插件html-webpack-inline-source-plugin 确实可以插入源文件 ,参数用正则表达式。 但是还是有弊端!用了这插件,似乎就不能用chunks 了! 所以老师这个还是比较好,就是稍微麻烦点。
2018-01-24
var path =require("path");
module.exports = {
entry:'./src/script/main.js',
output: {
path:path.resolve(__dirname,'./dist/js'),
filename:'bundle.js'
}
}
module.exports = {
entry:'./src/script/main.js',
output: {
path:path.resolve(__dirname,'./dist/js'),
filename:'bundle.js'
}
}
2018-01-24
require('path') 视频中老师讲到 这个path是node自带的api,但是我们全程没有安装node啊,关于这个path还是没有明白
2018-01-23
讲真的 您讲我内容是免费的让我很诧异。真心全是干货。网易云有个wos将的视频,那简直就是坑人的。。。老师666哒
2018-01-23
`webpack 3.10.0`下,老师课程中测试用例都可运行,需要参考代码可以看这里:https://github.com/WjmNightingale/webpack-test,如果能帮助学习的小伙伴,可以点个star哟
2018-01-23
方法二:
module.exports = {
entry: "./project/src/scripts/main.js",
output: {
path: __dirname + "/project/dist/scripts/", //处理文件路径为绝对路径
filename: "bundle.js"
}
}
其实吧,也不怪老师!毕竟前端更新变化快,以前可以的方法现在未必就可以了!所以。。。
换个角度想不正是因为这些坑我们才可以更好的理解学到更多吗?
module.exports = {
entry: "./project/src/scripts/main.js",
output: {
path: __dirname + "/project/dist/scripts/", //处理文件路径为绝对路径
filename: "bundle.js"
}
}
其实吧,也不怪老师!毕竟前端更新变化快,以前可以的方法现在未必就可以了!所以。。。
换个角度想不正是因为这些坑我们才可以更好的理解学到更多吗?
2018-01-23
方法二:
var path = require("path"); //引入nodejs中的path模块
module.exports = {
entry: "./project/src/scripts/main.js",
output: {
path: path.resolve(__dirname, "./project/dist/scripts/"), //处理文件路径为绝对路径
filename: "bundle.js"
}
}
var path = require("path"); //引入nodejs中的path模块
module.exports = {
entry: "./project/src/scripts/main.js",
output: {
path: path.resolve(__dirname, "./project/dist/scripts/"), //处理文件路径为绝对路径
filename: "bundle.js"
}
}
2018-01-23