JsSIP icon indicating copy to clipboard operation
JsSIP copied to clipboard

circular dependencies for Rollup build

Open xsdhy opened this issue 4 years ago • 1 comments

I am getting the following error when building with rollop. This can lead to problems with variables being defined in the wrong order when using the commonjs plugin.

(!) Circular dependencies
node_modules/jssip/lib-es5/Utils.js -> node_modules/jssip/lib-es5/URI.js -> node_modules/jssip/lib-es5/Utils.js
node_modules/jssip/lib-es5/Utils.js -> node_modules/jssip/lib-es5/URI.js -> D:\code\web\softphone\node_modules\jssip\lib-es5\Utils.js?commonjs-proxy -> node_modules/jssip/lib-es5/Utils.js
node_modules/jssip/lib-es5/URI.js -> node_modules/jssip/lib-es5/Grammar.js -> node_modules/jssip/lib-es5/URI.js
...and 6 more
created lib/bundle.cjs.js, lib/bundle.esm.js, lib/bundle.browser.js in 4.4s

rollup config

import typescript from '@rollup/plugin-typescript';
import commonjs from "@rollup/plugin-commonjs";
import pkg from '../package.json'
import nodeResolve from "@rollup/plugin-node-resolve";
import json from "@rollup/plugin-json";
import nodePolyfills from 'rollup-plugin-node-polyfills';

export default {
  input: "./src/index.ts",
  output: [
    {file: pkg.main, format: 'cjs', },
    {file: pkg.module, format: 'esm',},
    {file: pkg.browser,format: 'umd',name: 'cti',sourcemap:true},
  ],
  plugins: [
    typescript(),
    nodeResolve({preferBuiltins: false}),
    commonjs(),
    json(),
    nodePolyfills()
  ],
}

xsdhy avatar Aug 14 '22 08:08 xsdhy

can use @rollup/plugin-commonjs 22.0.2

xsdhy avatar Aug 14 '22 09:08 xsdhy