Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable sourceMap in devMode without FOUC #329

Open
1 of 6 tasks
Armour opened this issue Jul 26, 2018 · 1 comment
Open
1 of 6 tasks

Enable sourceMap in devMode without FOUC #329

Armour opened this issue Jul 26, 2018 · 1 comment
Assignees

Comments

@Armour
Copy link
Owner

Armour commented Jul 26, 2018

I'm submitting a

  • Bug report
  • Feature request
  • Performance issue
  • Regression (a behavior that used to work and stopped working in a new release)
  • Documentation issue or request
  • Other... Please describe:

Current behavior

Enable css-loader sourceMap option will cause FOUC.

Expected behavior

No FOUC when sourceMap enabled for css-loader.

Minimal reproduction of the problem with instructions

In webpack.config.base.babel.js:

...
      // Use a list of loaders to load css files
      {
        test: /\.css$/,
        use: [
          devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
          { loader: 'css-loader', options: { sourceMap: !devMode, importLoaders: 1 } }, // TODO: enable sourceMap in devMode without FOUC
          { loader: 'postcss-loader', options: { sourceMap: true, plugins: () => [postcssImport, postcssPresetEnv, cssnano] } },
        ],
      },
      // Use a list of loaders to load scss files
      {
        test: /\.scss$/,
        use: [
          devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
          { loader: 'css-loader', options: { sourceMap: !devMode, importLoaders: 2 } }, // TODO: enable sourceMap in devMode without FOUC
          { loader: 'postcss-loader', options: { sourceMap: true, plugins: () => [postcssImport, postcssPresetEnv, cssnano] } },
          { loader: 'sass-loader', options: { sourceMap: true } },
        ],
      },
...

simply change !devMode to true will cause the FOUC.

What is the motivation / use case for changing the behavior?

SourceMap support in development.

@Armour Armour self-assigned this Jul 26, 2018
@Armour
Copy link
Owner Author

Armour commented Jul 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant