-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config-test.js
57 lines (56 loc) · 1.54 KB
/
webpack.config-test.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
53
54
55
56
57
const nodeExternals = require('webpack-node-externals');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const path = require('path');
const glob = require('glob');
module.exports = {
entry: {
entry: glob.sync('./tests/**/*.spec.js'),
},
mode: 'none',
target: 'node', // webpack should compile node compatible code
externals: [nodeExternals()], // ignore all modules in node_modules folder,
devtool: 'inline-cheap-module-source-map',
module: {
rules: [
{
test: /\.scss$/i,
use: [
MiniCssExtractPlugin.loader, // add css to it's own file
'css-loader', // convert css into js
{
loader: 'sass-loader',
options: {
sassOptions: {
minimize: false,
outputStyle: 'expanded',
},
},
},
],
},
{
test: /\.(svg|png|jpg|gif)$/,
use: {
loader: 'file-loader',
options: {
name: '[path][name].[ext]',
outputPath: 'images',
esModule: false,
},
},
},
],
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist_tests/'),
devtoolModuleFilenameTemplate: '[absolute-resource-path]',
devtoolFallbackModuleFilenameTemplate: '[absolute-resource-path]?[hash]',
},
plugins: [new MiniCssExtractPlugin(
{
filename: '[name].css',
},
), new CleanWebpackPlugin()],
};