Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow edit of commonJs plugin params #187

Merged
merged 6 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/rollup/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ export const plugins = [
// https://github.com/rollup/plugins/tree/master/packages/commonjs
rollupConfig.plugins.push(commonjs({
esmExternals: id => !id.startsWith('unenv/'),
requireReturnsDefault: 'auto'
requireReturnsDefault: 'auto',
...nitro.options.commonJs
}))

// https://github.com/rollup/plugins/tree/master/packages/json
Expand Down
2 changes: 2 additions & 0 deletions src/types/nitro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type { StorageMounts } from '../rollup/plugins/storage'
import type { RollupConfig } from '../rollup/config'
import type { Options as EsbuildOptions } from '../rollup/plugins/esbuild'
import { NitroErrorHandler, NitroDevEventHandler, NitroEventHandler } from './handler'
import type { RollupCommonJSOptions } from '@rollup/plugin-commonjs'

export interface Nitro {
options: NitroOptions,
Expand Down Expand Up @@ -139,6 +140,7 @@ export interface NitroOptions {
externals: NodeExternalsOptions
analyze: false | PluginVisualizerOptions
replace: Record<string, string | ((id: string) => string)>
commonJs?: RollupCommonJSOptions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use commonJS for naming?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done πŸ‘


// Advanced
typescript: {
Expand Down