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.

chunk.mapModules is not a function

See original GitHub issue

Before you open an issue, please check if a similar issue already exists or has been closed before.

When reporting a bug, please be sure to include the following:

  • A descriptive title
  • An isolated way to reproduce the behavior (example: GitHub repository with code isolated to the issue that anyone can clone to observe the problem)
  • What version of purgecss you’re using, and the platform(s) you’re running it on “purgecss-webpack-plugin”: “^0.19.0” Windows 7
  • The behavior you expect to see, and the actual behavior not crashing when npm run build
new PurgecssPlugin({
  paths: [path.resolve(__dirname, './dist/index.html'), ...glob.sync(path.resolve(__dirname, './src/*'))],
})

dist/ is the bundle output folder src/ is where the React components go.

output:

...
C:\dev\projects\webui\node_modules\purgecss-webpack-plugin\lib\purgecss-webpack-plugin.js:148
    return chunk.mapModules(function (module) {
                 ^

TypeError: chunk.mapModules is not a function
    at files (C:\dev\projects\webui\node_modules\purgecss-webpack-plugin\lib\purgecss-webpack-plugin.js:148:18)
    at C:\dev\projects\webui\node_modules\purgecss-webpack-plugin\lib\purgecss-webpack-plugin.js:199:90
    at Array.forEach (<anonymous>)
    at C:\dev\projects\webui\node_modules\purgecss-webpack-plugin\lib\purgecss-webpack-plugin.js:195:39
    at Array.forEach (<anonymous>)

Can you spot what could be causing this error? Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
jsnaniganscommented, Feb 5, 2018

@CanbingChen this should fix your issue: In your config of purgecss add the option { nodir: true } into glob, like this: paths: glob.sync('${PATHS.src}/*', { nodir: true })

0reactions
CanbingChencommented, Feb 5, 2018

@Ffloriel I’ve got the error after update webpack.the terminal show “illegal operation on a directory, read”

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: chunks.map is not a function · Issue #19 - GitHub
Just tried to create an example for styled-jss and got this error: prejss git:(prejss) npm run build (node:96238) fs: re-evaluating native ...
Read more >
chunks.some is not a function - webpack - Stack Overflow
I managed to fix it by using the following: splitChunks: { cacheGroups: { vendor: { name: 'vendor', chunks: 'all', reuseExistingChunk: true, ...
Read more >
TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >
How to Solve the Chunk Load Error in JavaScript - Rollbar
Whenever there's an error observed in dynamically fetching helper JavaScript files known as Chunks, a ChunkLoad Error is thrown.
Read more >
TypeError Handling in React.js for Map Function | Pluralsight
This error occurs because your data is not an array. The .map() function only works with arrays. First, you'll need to confirm your...
Read more >

github_iconTop Related Medium Post

No results found

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