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.

Problems with `dom-iterator` and webpack

See original GitHub issue

The dom-iterator dependency causes problems in my webpack project when I import from react-live. Webpack tries to package the xor require() which is in a catch block in that package. The error looks like this:

Error: ./~/dom-iterator/index.js
Module not found: Error: Cannot resolve module 'xor' in directory/node_modules/dom-iterator
resolve module xor in directory/node_modules/dom-iterator
  looking for modules in directory
    directory/xor doesn't exist (module as directory)
    resolve 'file' xor in directory
      resolve file
        directory/xor doesn't exist
        directory/xor.js doesn't exist
        directory/xor.jsx doesn't exist
        directory/xor.cjsx doesn't exist
        directory/xor.coffee doesn't exist
        directory/xor.ts doesn't exist
        directory/xor.tsx doesn't exist
        directory/xor.json doesn't exist
        directory/xor.less doesn't exist
        directory/xor.css doesn't exist
        directory/xor.scss doesn't exist
        directory/xor.sass doesn't exist
        directory/xor.toml doesn't exist
        directory/xor.yml doesn't exist
        directory/xor.yaml doesn't exist

Any suggestions on how to get around this problem? Note this also happens for the props module required the same way in that module.

Oddly, I don’t have this problem with development builds, only production builds. Possibly something in my webpack config?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
bvaughncommented, Aug 31, 2017

Hi all 😄

In my case, I’m adding react-live to Gatsby. They have their own webpack settings (using webpack 1). Hmm, another webpack thing to try to figure out!

I’ve encountered this same issue when running yarn build on a Gatsby site that also uses react-live (v1.7.1). Patching the Webpack config to ignore the xor and props plugins (as described above) is a successful short term workaround. So thanks for that!

In case it’s at all helpful, my Gatsby project is available at bvaughn/react/tree/gatsby/www.

1reaction
webOS101commented, Jul 17, 2017

I solved this problem by creating a gatsby-node.js file like follows:

const webpack = require('webpack');

exports.modifyWebpackConfig = function (config, stage) {
	config.plugin('ignore', () => new webpack.IgnorePlugin(/^(xor|props)$/));
	return config;
};

Hopefully that works, I extracted it from a much bigger file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Problem with Webpack and Why It Is (Kind of) Our Fault
The problem with Webpack is that it does not pick a side. It wants to be batteries-included but pluggable, standalone but extensible, ...
Read more >
How I solved and debugged my Webpack issue through trial ...
When webpack bundles your source code, it can become difficult to track down errors and warnings to their original location.
Read more >
Compare Versions | @teambit/application | npm
We found errors while resolving dependencies that may result in an incomplete or inaccurate dependency graph. Show details. Errors found while resolving some ......
Read more >
recursive-iterator - npm Package Health Analysis | Snyk
The npm package recursive-iterator was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package was deemed as...
Read more >
API Changes from v3 to v4 - CKEditor 4 Documentation
... plugins/domiterator/plugin.js => core/dom/iterator.js; plugins/htmldataprocessor/plugin.js => core/htmldataprocessor.js ...
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