TrySound / postcss-easy-import

PostCSS plugin to inline @import rules content with extra features
MIT License
200 stars 25 forks source link

Not able to import without extension and when file contains comments #30

Open StefanoSega opened 5 years ago

StefanoSega commented 5 years ago

So far my postcss.config.js file looks like this:

module.exports = ({ file, options, env }) => ({
  plugins: [
    require('postcss-easy-import'),
    require('postcss-url'),
    require('postcss-preset-env')({
      browsers: 'last 4 versions',
      stage: 0,
    }),
    require('postcss-strip-inline-comments'),
    require('postcss-sassy-mixins'),
    require('postcss-simple-vars'),
    require('postcss-nested'),
    require('pixrem')(),
    require('autoprefixer')({
      browsers: ['last 4 versions'],
    }),
    env === 'production' ? require('cssnano') : null,
  ],
});

and my webpack.config.js includes these parts:

 const MiniCssExtractPlugin = require("mini-css-extract-plugin");

...

module: {
    rules: [{
      test: /\.scss$/,
      use: [MiniCssExtractPlugin.loader, {
        loader: 'css-loader',
        options: {
          importLoaders: 1,
          modules: true,
          sourceMap: true,
          localIdentName: '[path]___[name]__[local]___[hash:base64:5]',
        },
      }, 'postcss-loader'],
    }],
  },
...
plugins: [
...
    new MiniCssExtractPlugin({
      filename: "style.css",
      chunkFilename: "[id].css"
    }),
  ],

the webpack build breaks always whenever: