jlengstorf / learn-rollup

This is an example project to accompany a tutorial on using Rollup.
https://code.lengstorf.com/learn-rollup-js/
ISC License
191 stars 61 forks source link

rollup打包时怎么排除第三方组件所引进的样式文件 #53

Closed gogoinga closed 3 years ago

gogoinga commented 3 years ago

项目中,import了一个第三方组件的css文件,打包后出现在了输出文件的styleInject里,请问我要怎么排除掉这个样式文件的打包呢 例如: import 'node_modules/第三方组件/第三方.css'; import styles from './本地的.less';

jlengstorf commented 3 years ago

(I ran your issue through Google translate, so hopefully I'm answering this correctly)

to exclude a file, I believe you need to set it as external, which is explained in this comment: https://github.com/rollup/rollup/issues/497#issuecomment-180853394

if that doesn't work for you, you may have better luck asking on the rollup repo! good luck!