CommonJS 模块
我们写组件库或工具库时不可避免会用到外部库,这些外部库可能是符合 CommonJS 规范的。...而 Rollup 力图实现 ES 模块的规范, 因此,加载 CommonJS 模块和使用 Node 模块位置解析逻辑都被实现为可选插件,默认情况下不在 Rollup 内核中。...: 'React',
'react-native': 'reactNative',
},
sourcemap: true,
},
plugins:...', 'react-native'],
},
// CommonJS (for Node) and ES module (for bundlers) build.../dist/es/index.js', format: 'es' },
],
plugins: [typescript()],
external: ['react', 'react-native