1 | var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin');
|
2 |
|
3 | // see this link for more info on what all of this means
|
4 | // https://github.com/halt-hammerzeit/webpack-isomorphic-tools
|
5 | module.exports = {
|
6 |
|
7 | // when adding "js" extension to asset types
|
8 | // and then enabling debug mode, it may cause a weird error:
|
9 | //
|
10 | // [0] npm run start-prod exited with code 1
|
11 | // Sending SIGTERM to other processes..
|
12 | //
|
13 | // debug: true,
|
14 |
|
15 | assets: {
|
16 | images: {
|
17 | extensions: [
|
18 | 'jpeg',
|
19 | 'jpg',
|
20 | 'png',
|
21 | 'gif'
|
22 | ],
|
23 | parser: WebpackIsomorphicToolsPlugin.url_loader_parser
|
24 | },
|
25 | fonts: {
|
26 | extensions: [
|
27 | 'woff',
|
28 | 'woff2',
|
29 | 'ttf',
|
30 | 'eot'
|
31 | ],
|
32 | parser: WebpackIsomorphicToolsPlugin.url_loader_parser
|
33 | },
|
34 | svg: {
|
35 | extension: 'svg',
|
36 | parser: WebpackIsomorphicToolsPlugin.url_loader_parser
|
37 | },
|
38 | style_modules: {
|
39 | extensions: ['less','scss','css'],
|
40 | filter: function(module, regex, options, log) {
|
41 | if (options.development) {
|
42 | // in development mode there's webpack "style-loader",
|
43 | // so the module.name is not equal to module.name
|
44 | return WebpackIsomorphicToolsPlugin.style_loader_filter(module, regex, options, log);
|
45 | } else {
|
46 | // in production mode there's no webpack "style-loader",
|
47 | // so the module.name will be equal to the asset path
|
48 | return regex.test(module.name);
|
49 | }
|
50 | },
|
51 | path: function(module, options, log) {
|
52 | if (options.development) {
|
53 | // in development mode there's webpack "style-loader",
|
54 | // so the module.name is not equal to module.name
|
55 | return WebpackIsomorphicToolsPlugin.style_loader_path_extractor(module, options, log);
|
56 | } else {
|
57 | // in production mode there's no webpack "style-loader",
|
58 | // so the module.name will be equal to the asset path
|
59 | return module.name;
|
60 | }
|
61 | },
|
62 | parser: function(module, options, log) {
|
63 | if (options.development) {
|
64 | return WebpackIsomorphicToolsPlugin.css_modules_loader_parser(module, options, log);
|
65 | } else {
|
66 | // in production mode there's Extract Text Loader which extracts CSS text away
|
67 | return module.source;
|
68 | }
|
69 | }
|
70 | }
|
71 | }
|
72 | }
|