1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
| import fs from "fs";
| import path from "path";
| import ExtractTextPlugin from "extract-text-webpack-plugin";
|
| export function readFileOrEmpty(path) {
| try {
| return fs.readFileSync(path, "utf-8");
| } catch (e) {
| return "";
| }
| }
|
| export const defaultConfig = {
| entry: "./index",
| module: {
| rules: [
| {
| test: /\.css$/,
| use: ExtractTextPlugin.extract({
| fallback: { loader: "style-loader" },
| use: {
| loader: "css-loader"
| }
| })
| }
| ]
| },
| plugins: [],
| context: __dirname,
| output: {
| filename: "destination.js",
| path: path.resolve(__dirname, "../", "js", "default-exports")
| }
| };
|
| export function checkForWebpackErrors({ err, stats, done }) {
| if (err) return done(err);
| if (stats.hasErrors()) return done(new Error(stats.toString()));
| }
|
|