-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathwebpack.config.js
53 lines (43 loc) · 1.41 KB
/
webpack.config.js
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
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* This file is used to test ifdef-loader on a real webpack environment.
* It reads "spec/data/webpack.in.js" and outputs "spec/data/webpack.out.actual.js"
* which is later compared with "spec/data/webpack.out.js"
*
*/
const opts = {
DEBUG: true,
version: 3,
"ifdef-verbose": true, // add this for verbose output
"ifdef-triple-slash": true, // add this to use double slash comment instead of default triple slash
"ifdef-fill-with-blanks": true // add this to remove code with blank spaces instead of "//" comments
};
// if using query strings
const q = require('querystring').encode(opts);
/************************************************************/
const webpack = require('webpack');
module.exports = function(env)
{
const entry = "./spec/data/webpack.in.js";
const loaders = [{
test: /\.in(\.module)?\.js$/,
exclude: /node_modules/,
use: [{
loader: `${__dirname}/ifdef-loader`,
options: opts
}]
// alternate:
// loader: `${__dirname}/ifdef-loader?${q}`,
}];
let config =
{
module: { rules: loaders },
entry: entry,
cache: true,
output: {
libraryTarget: "this",
path: `${__dirname}/spec/data`,
filename: opts["ifdef-fill-with-blanks"] ? "webpack.fwb.out.actual.js" : "webpack.out.actual.js",
}
};
return config;
};