|
| 1 | +const path = require('path') |
| 2 | +const trash = require('trash') |
1 | 3 | const {exportPathMap} = require('nextjs-export-path-map') |
2 | | -const trash = require('trash') |
3 | 4 |
|
4 | 5 | module.exports = { |
5 | | - webpack(config) { |
6 | | - if (process.env.ANALYZE) { |
7 | | - config.plugins.push(new BundleAnalyzerPlugin({ |
8 | | - analyzerMode: 'server', |
9 | | - analyzerPort: 8888, |
10 | | - openAnalyzer: true |
11 | | - })) |
| 6 | + webpack(config) { |
| 7 | + if (process.env.ANALYZE) { |
| 8 | + config.plugins.push(new BundleAnalyzerPlugin({ |
| 9 | + analyzerMode: 'server', analyzerPort: 8888, openAnalyzer: true |
| 10 | + })) |
| 11 | + } |
| 12 | + config.module.rules.push({ |
| 13 | + test: /\.p?css$/, use: [ |
| 14 | + { |
| 15 | + loader: 'emit-file-loader', options: { |
| 16 | + name: 'dist/[path][name].[ext]' |
12 | 17 | } |
13 | | - config.module.rules.push({ |
14 | | - test: /\.p?css$/, |
15 | | - use: [ |
16 | | - { |
17 | | - loader: 'emit-file-loader', |
18 | | - options: { |
19 | | - name: 'dist/[path][name].[ext]' |
20 | | - } |
21 | | - }, |
22 | | - { |
23 | | - loader: 'skeleton-loader', |
24 | | - options: { |
25 | | - procedure : function (stylesheet) { |
26 | | - trash(this._module.userRequest + '.json') |
27 | | - return 'exports.default = \'' + stylesheet + '\';' |
28 | | - }, cacheable: false |
29 | | - } |
30 | | - }, |
31 | | - 'postcss-loader' |
32 | | - ] |
33 | | - }) |
34 | | - return config |
35 | | - }, |
36 | | - exportPathMap: exportPathMap.bind(null, path.join(__dirname, 'pages')) |
| 18 | + }, { |
| 19 | + loader: 'skeleton-loader', options: { |
| 20 | + procedure : function (stylesheet) { |
| 21 | + trash(this._module.userRequest + '.json') |
| 22 | + return 'exports.default = \'' + stylesheet + '\';' |
| 23 | + }, cacheable: false |
| 24 | + } |
| 25 | + }, 'postcss-loader' |
| 26 | + ] |
| 27 | + }) |
| 28 | + return config |
| 29 | + }, |
| 30 | + exportPathMap: exportPathMap.bind(null, path.join(__dirname, 'pages')) |
37 | 31 | } |
0 commit comments