ace-diff/ace-diff

Warning from webpack when using ace-diff 3

Closed this issue ยท 3 comments

WARNING in ./node_modules/ace-diff/dist/ace-diff.min.js 1:292-296
Critical dependency: the request of a dependency is an expression

I suspect ace-diff is doing some dynamic require that webpack doesn't like. FYI I think webpack is fine with having require statements that are conditionally executed but has trouble with dynamic expressions in the require call itself. Could the code be refactored somehow to improve this?

Thanks for all the hard work on this library!

Oddly this warning doesn't happen if I change ace-diff's entry point ("browser" field in ace-diff's package.json) from dist/ace-diff.min.js to src/index.js.

When using webpack I think having src/index.js as the entry point is actually desirable, because it will be doing the minification/bundling anyway. Unfortunately making this change requires me to edit ./node-modules/ace-diff/package.json on disk which isn't really a very sustainable solution.

Hey, I couldn't replicate this with a minimal webpack setup. You can avoid modifying the package.json and try importing/requiring the specific source that you want e.g.

- import * as AceDiff from 'ace-diff'
+ import * as AceDiff from 'ace-diff/src/'

I think I'll remove the browser field, as module should be enough, considering there isn't a browser-specific distribution.

๐ŸŽ‰ This issue has been resolved in version 3.0.3 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€