question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DeprecationWarning: Module Chunks

See original GitHub issue

I’m getting the following warning/error when parsing a bootstrap _variable.scss file. My setup is it’s based on next.js

 ERROR  Failed to compile with 5 errors

This dependency was not found:

* fs in ./node_modules/mkdirp/index.js, ./node_modules/node-sass/lib/extensions.js and 3 others

To install it, you can run: npm install --save fs
(node:9903) DeprecationWarning: Module.chunks: Use Module.forEachChunk/mapChunks/getNumberOfChunks/isInChunk/addChunk/removeChunk instead

I’m not really whether if is related to this specific module or the sass-extract module, so I raised the same issue there.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
adamgrubercommented, Feb 27, 2018

I did some digging on this tonight. I believe the problem comes from importing sass-extract since it is not meant to be run in the browser. (It relies on node-sass which relies on fs which doesn’t exist in the browser.)

The correct way to make it work (assuming you are also using webpack) is to use sass-extract-loader. Here’s an example:

import React, { Component } from 'react';
import { ThemeProvider } from 'styled-components';
import logo from './logo.svg';
import './App.css';

const theme = require('sass-extract-loader?{"plugins": ["sass-extract-js"]}!./vars.scss');

class App extends Component {
  render() {
    return (
      <ThemeProvider theme={theme}>
        <div className="App">
          <header className="App-header">
            <img src={logo} className="App-logo" alt="logo" />
            <h1 className="App-title">Welcome to React</h1>
          </header>
          <p className="App-intro">
            To get started, edit <code>src/App.js</code> and save to reload.
          </p>
        </div>
      </ThemeProvider>
    );
  }
}

export default App;

I’ll have to update the documentation to reflect this.

0reactions
emsiuser1commented, Feb 9, 2021

What if you aren’t using webpack? I am using a gulp compiling process. Is there anyway to use this library with that?

Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack 3 DeprecationWarning: Chunk.modules is deprecated
I was getting the deprecated warning in the extract-text-webpack-plugin 3.0.0-beta.3 . After I update the extract-text-webpack-plugin to ...
Read more >
Module.chunksIterable: Use new ChunkGraph API ... - GitHub
Do you want to request a feature, report a bug or ask a question? Deprecation warning What is the current behavior?
Read more >
Compilation Hooks | webpack
Called when the modules id optimization phase has completed. Callback Parameters: modules. reviveChunks. SyncHook. Restore chunk information from records.
Read more >
deprecationwarning: compilation.hooks.normalmoduleloader ...
1 I use the npm package service-worker-loader. I get this waring when building the project: node:25260) [DEP_WEBPACK_COMPILATION_CACHE] DeprecationWarning: ...
Read more >
Fix deprecation warning when running webpack - GitLab.org
DeprecationWarning : Chunk.modules is deprecated. Use Chunk.getNumberOfModules/mapModules/forEachModule/containsModule instead.
Read more >

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found