|
| 1 | +const path = require("path"); |
| 2 | +const webpack = require("webpack"); |
| 3 | +const projectRoot = path.resolve(__dirname, "../"); |
| 4 | +const vueLoaderConfig = require("./vue-loader.conf"); |
| 5 | + |
| 6 | +let rules = [ |
| 7 | + { |
| 8 | + test: /\.(js|vue)$/, |
| 9 | + loader: "eslint-loader", |
| 10 | + enforce: "pre", |
| 11 | + include: [path.resolve("src"), path.resolve("dev")], |
| 12 | + options: { |
| 13 | + formatter: require("eslint-friendly-formatter") |
| 14 | + } |
| 15 | + }, |
| 16 | + { |
| 17 | + test: /\.vue$/, |
| 18 | + loader: "vue-loader", |
| 19 | + include: [path.resolve("src"), path.resolve("dev")], |
| 20 | + exclude: /node_modules/, |
| 21 | + options: vueLoaderConfig |
| 22 | + }, |
| 23 | + { |
| 24 | + test: /\.js$/, |
| 25 | + loader: "babel-loader", |
| 26 | + include: [path.resolve("src"), path.resolve("dev")], |
| 27 | + exclude: /node_modules/ |
| 28 | + }, |
| 29 | + { |
| 30 | + test: /\.(woff2?|svg)$/, |
| 31 | + loader: "url-loader", |
| 32 | + include: [path.resolve("src"), path.resolve("dev")] |
| 33 | + }, |
| 34 | + { |
| 35 | + test: /\.(ttf|eot)$/, |
| 36 | + loader: "url-loader", |
| 37 | + include: [path.resolve("src"), path.resolve("dev")] |
| 38 | + } |
| 39 | +]; |
| 40 | + |
| 41 | +module.exports = { |
| 42 | + devtool: "source-map", |
| 43 | + devServer: { |
| 44 | + contentBase: [path.resolve("dev/projects")] |
| 45 | + }, |
| 46 | + entry: { |
| 47 | + full: path.resolve("dev", "projects", "full", "main.js"), |
| 48 | + basic: path.resolve("dev", "projects", "basic", "main.js"), |
| 49 | + mselect: path.resolve("dev", "projects", "multiselect", "main.js"), |
| 50 | + grouping: path.resolve("dev", "projects", "grouping", "main.js"), |
| 51 | + checklist: path.resolve("dev", "projects", "checklist", "main.js"), |
| 52 | + picker: path.resolve("dev", "projects", "picker", "main.js") |
| 53 | + }, |
| 54 | + |
| 55 | + output: { |
| 56 | + path: path.resolve("dev/projects"), |
| 57 | + filename: "[name].js", |
| 58 | + publicPath: "/" |
| 59 | + }, |
| 60 | + |
| 61 | + plugins: [ |
| 62 | + new webpack.DefinePlugin({ |
| 63 | + "process.env": { |
| 64 | + NODE_ENV: JSON.stringify("development"), |
| 65 | + FULL_BUNDLE: true |
| 66 | + } |
| 67 | + }) |
| 68 | + ], |
| 69 | + |
| 70 | + module: { |
| 71 | + rules |
| 72 | + }, |
| 73 | + |
| 74 | + resolve: { |
| 75 | + extensions: [".js", ".vue", ".json"], |
| 76 | + alias: { |
| 77 | + vue$: "vue/dist/vue.esm.js", |
| 78 | + "@": path.resolve("src") |
| 79 | + } |
| 80 | + } |
| 81 | +}; |
0 commit comments