Skip to content

Commit

Permalink
fix(docz-plugin-css): production build
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Jun 22, 2018
1 parent 615aa1f commit 1a66d8a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/docz-plugin-css/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ const loaders = {
}),

sass: (opts: Opts = {}) =>
getStyleLoaders(require.resolve('sass-loader'), opts),
getStyleLoaders(
require.resolve('sass-loader'),
merge(opts, { indentedSyntax: false })
),

less: (opts: Opts = {}) =>
getStyleLoaders(require.resolve('less-loader'), opts),
Expand Down Expand Up @@ -122,6 +125,7 @@ export const css = (opts: CSSPluginOptions) =>
)

if (!dev) {
const test = tests[opts.preprocessor || 'postcss']
const minimizer = config.optimization.minimizer || []
const splitChunks = { ...config.optimization.splitChunks }

Expand All @@ -132,8 +136,8 @@ export const css = (opts: CSSPluginOptions) =>
config.optimization.splitChunks = merge(splitChunks, {
cacheGroups: {
styles: {
test: (m: any) => test.test(m.type),
name: 'styles',
test: (m: any) => /css-extract/.test(m.type),
chunks: 'all',
enforce: true,
},
Expand All @@ -142,8 +146,7 @@ export const css = (opts: CSSPluginOptions) =>

config.plugins.push(
new MiniCssExtractPlugin({
filename: '[name].[hash].css',
chunkFilename: '[id].[hash].css',
filename: 'static/css/[name].[hash].css',
})
)
}
Expand Down

0 comments on commit 1a66d8a

Please sign in to comment.