LearnNewsExamplesServices
Frontmatter
id7816
titleFix Webpack critical dependency warning in HighlightJs dynamic import
stateClosed
labels
bugrefactoring
assigneestobiu
createdAtNov 19, 2025, 6:25 PM
updatedAtNov 19, 2025, 6:27 PM
githubUrlhttps://github.com/neomjs/neo/issues/7816
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtNov 19, 2025, 6:27 PM

Fix Webpack critical dependency warning in HighlightJs dynamic import

Closed v11.6.1 bugrefactoring
tobiu
tobiu commented on Nov 19, 2025, 6:25 PM

Webpack throws a "Critical dependency" warning in src/util/HighlightJs.mjs because of a dynamic import using a variable path:

let path   = Neo.config.basePath + 'dist/highlight/highlight.custom' + (this.debug ? '' : '.min') + '.js',
    module = await import(path);

This is a valid use case for loading a runtime library. To fix the build warning, we need to instruct Webpack to ignore this specific import.

Solution: Add /* webpackIgnore: true */ to the import statement in src/util/HighlightJs.mjs.

module = await import(/* webpackIgnore: true */ path);
tobiu added the bug label on Nov 19, 2025, 6:25 PM
tobiu added the refactoring label on Nov 19, 2025, 6:25 PM
tobiu assigned to @tobiu on Nov 19, 2025, 6:26 PM
tobiu referenced in commit e72c5da - "Fix Webpack critical dependency warning in HighlightJs dynamic import #7816" on Nov 19, 2025, 6:26 PM
tobiu closed this issue on Nov 19, 2025, 6:27 PM