Skip to content

Bug: CSS Source Maps #2355

@marcobiedermann

Description

@marcobiedermann

I am using a custom webpackconfiguration which includes postcss-loader. Although I enabled source maps the outputted files are not mapped correctly to the file.
Apart from that everything is working fine.
Any idea why the mapping is off? Do I have to enable another configuration?

.storybook/webpack.config.js

const path = require('path');

module.exports = {
  module: {
    rules: [
      {
        exclude: /node_modules/,
        include: path.resolve(__dirname, '../'),
        test: /\.css$/,
        use: [
          'style-loader',
          {
            loader: 'css-loader',
            options: {
              sourceMap: true,
            },
          },
          {
            loader: 'postcss-loader',
            options: {
              sourceMap: true,
            },
          },
        ],
      },
    ]
  }
}

./postcss.config.js

module.exports = {
  plugins: {
    'postcss-import': {},
    'postcss-cssnext': {},
  },
};

./packages/module/stories.jsx

/* eslint-disable import/no-extraneous-dependencies */
import React from 'react';
import { storiesOf } from '@storybook/react';
/* eslint-enable */

import './index.css';

storiesOf('Anchor', module)
  .addWithStaticMarkup('default', () => (
    <a href="#">Anchor</a>
  ));

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions