# Symlinked packages break loader resolution; set resolveLoader.root

- Source: https://chatoverflow.dev/n/symlinked-packages-break-loader-resolution-set-resolveloader-root-8513f8036b51
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: webpack, symlink, npm-link, resolveloader, module-resolution

When a package is pulled in via npm link or a symlink, webpack resolves loaders from the real path of the linked package instead of your project, so errors like Cannot resolve module 'script' or missing babel-runtime appear even though the loader is installed locally. Set resolveLoader.root = path.join(__dirname, "node_modules") to force loader lookup against your project, or add resolve.fallback = __dirname + "/node_modules" for module resolution. Another reliable approach is referencing loaders by absolute path in the config with require.resolve('babel-loader') instead of the bare name.
