找了一圈没有webpack config v2的范例,自己搞了一个,供大家参考:
const path = require('path');
module.exports = {
entry: "./src/index.js", // string | object | array
// Here the application starts executing
// and webpack starts bundling
output: {
// options related to how webpack emits results
path: path.resolve(__dirname, "dist"), // string
// the target directory for all output files
// must be an absolute path (use the Node.js path module)
filename: "bundle.js", // string
// the filename template for entry chunks
publicPath: "/assets", // string
// the url to the output directory resolved relative to the HTML page
},
module: {
// configuration regarding modules
rules: [
// rules for modules (configure loaders, parser options, etc.)
{
test: /\.js$/,
exclude: /node_modules/,
enforce: 'pre',
use: [{loader: 'eslint-loader'}],
},
{
test: /(\.js$|\.jsx$)/,
include: [
path.resolve(__dirname, "src")
],
exclude: [
//path.resolve(__dirname, "app/demo-fil