Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LitileXueZha/aa7bf4092ae8a230f68b28aaad4be277 to your computer and use it in GitHub Desktop.
Save LitileXueZha/aa7bf4092ae8a230f68b28aaad4be277 to your computer and use it in GitHub Desktop.
rollup-plugin-node-resolve-circular-dependencies-with-typescript

Fix rollup Circular dependencies

Errors:

(!) Circular dependencies
node_modules/highlight.js/lib/languages/1c.js.js -> node_modules/highlight.js/lib/languages/1c.js.js
...

The rollup.config.js maybe like:

export default {
  plugins: [
    nodeResolve(),
    ts(),
  ],
}

It seeems that when you import hljs from 'hightlight.js', the node-resolve plugin will add .js extension to importer, extractly is in highlight.js/lib/index.js. And the library is very strange that you can see a *.js file and *.js.js file,,???

The solution is put '@rollup/plugin-typescript' before the node-resolve plugin.

export default {
  plugins: [
+   ts(),            // <== here
+   nodeResolve(),
  ],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment