gpt4 book ai didi

svelte - 汇总插件的顺序重要吗?

转载 作者:行者123 更新时间:2023-12-04 11:23:15 25 4
gpt4 key购买 nike

使用 rollup 和 Svelte 似乎改变了 rollup.config.js 中插件的顺序没什么区别。

plugins: [
svelte({
preprocess: sveltePreprocess(),
compilerOptions: {
// enable run-time checks when not in production
dev: !production
}
}),
// we'll extract any component CSS out into
// a separate file - better for performance
css({ output: 'bundle.css' }),

// If you have external dependencies installed from
// npm, you'll most likely need these plugins. In
// some cases you'll need additional configuration -
// consult the documentation for details:
// https://github.com/rollup/plugins/tree/master/packages/commonjs
resolve({
browser: true,
dedupe: ['svelte']
}),
commonjs(),
typescript({
sourceMap: !production,
inlineSources: !production
}),
// In dev mode, call `npm run start` once
// the bundle has been generated
!production && serve(),

// Watch the `public` directory and refresh the
// browser on changes when not in production
!production && livereload('public'),

// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser()
],
订单是否总是无关紧要?插件实际上是否按顺序运行?

最佳答案

是的,顺序很重要。
插件可以使用多个钩子(Hook),如 Rollup 的文档中所述。一些钩子(Hook)并行运行,但其他钩子(Hook),特别是变换钩子(Hook),按顺序运行,钩子(Hook)传递前一个的结果。
比如你在 Svelte 插件之前放了一个转换 JS 的插件,就不行。

关于svelte - 汇总插件的顺序重要吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65310809/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com