|
1 |
| -import * as webpack from 'webpack'; |
2 | 1 | import * as path from 'path';
|
3 |
| -import { |
4 |
| - SuppressExtractedTextChunksWebpackPlugin |
5 |
| -} from '../../plugins/suppress-entry-chunks-webpack-plugin'; |
6 |
| -import { extraEntryParser, getOutputHashFormat } from './utils'; |
7 |
| -import { WebpackConfigOptions } from '../webpack-config'; |
| 2 | +import * as webpack from 'webpack'; |
| 3 | +import { SuppressExtractedTextChunksWebpackPlugin } from '../../plugins/suppress-entry-chunks-webpack-plugin'; |
8 | 4 | import { pluginArgs, postcssArgs } from '../../tasks/eject';
|
| 5 | +import { WebpackConfigOptions } from '../webpack-config'; |
| 6 | +import { extraEntryParser, getOutputHashFormat } from './utils'; |
9 | 7 |
|
10 | 8 | const cssnano = require('cssnano');
|
11 | 9 | const postcssUrl = require('postcss-url');
|
@@ -39,7 +37,7 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
|
39 | 37 | // style-loader does not support sourcemaps without absolute publicPath, so it's
|
40 | 38 | // better to disable them when not extracting css
|
41 | 39 | // https://github.com/webpack-contrib/style-loader#recommended-configuration
|
42 |
| - const cssSourceMap = buildOptions.extractCss && buildOptions.sourcemaps; |
| 40 | + const cssSourceMap = buildOptions.sourcemaps; |
43 | 41 |
|
44 | 42 | // Minify/optimize css in production.
|
45 | 43 | const minimizeCss = buildOptions.target === 'production';
|
@@ -199,8 +197,12 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
|
199 | 197 | const ret: any = {
|
200 | 198 | include: globalStylePaths,
|
201 | 199 | test,
|
202 |
| - use: buildOptions.extractCss ? ExtractTextPlugin.extract(extractTextPlugin) |
203 |
| - : ['style-loader', ...extractTextPlugin.use] |
| 200 | + use: buildOptions.extractCss ? ExtractTextPlugin.extract(extractTextPlugin) : [{ |
| 201 | + loader: 'style-loader', |
| 202 | + options: { |
| 203 | + convertToAbsoluteUrls: cssSourceMap, |
| 204 | + }, |
| 205 | + }, ...extractTextPlugin.use], |
204 | 206 | };
|
205 | 207 | // Save the original options as arguments for eject.
|
206 | 208 | if (buildOptions.extractCss) {
|
|
0 commit comments