Skip to content

Commit

Permalink
fix: workaround for css-loader path issue
Browse files Browse the repository at this point in the history
Since the css-loader changed in the current version to
require tilde as prefix for module imports and every other
import is taken as relative import, hops follows this
and deprecates unprefixed imports.
This in turn conflicts with the postcss-import handler
which does not like the tilde prefix and we remove it
again here, if its encountered.
  • Loading branch information
KnisterPeter authored and herschel666 committed Jan 13, 2020
1 parent abfb61a commit d129f14
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/postcss/mixin.core.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const postcssImportPlugin = require('postcss-import');
const postcssImportResolver = require('postcss-import/lib/resolve-id');
const postcssPresetEnv = require('postcss-preset-env');
const ExtractCSSPlugin = require('mini-css-extract-plugin');
const FilterWarningsPlugin = require('webpack-filter-warnings-plugin');
Expand Down Expand Up @@ -37,7 +38,14 @@ const getCSSLoaderConfig = (browsers, additionalLoader) => {
options: {
ident: 'postcss',
plugins: [
postcssImportPlugin(),
postcssImportPlugin({
resolve: (id, base, options) =>
postcssImportResolver(
id.startsWith('~') ? id.slice(1) : id,
base,
options
),
}),
postcssPresetEnv({
browsers,
autoprefixer: {
Expand Down

0 comments on commit d129f14

Please sign in to comment.