Skip to content

Commit

Permalink
feat(cli): add --inlineDynamicImports flag
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed May 15, 2020
1 parent 9cedf6c commit d0b2433
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"branches": ["master"],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "angular",
"releaseRules": [
{ "type": "chore", "release": "patch" },
{ "type": "refactor", "release": "patch" },
{ "type": "style", "release": "patch" },
{ "scope": "no-release", "release": false },
{ "scope": "cli", "release": "patch" },
{ "scope": "patch", "release": "patch" }
]
}
],
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github"
]
}
4 changes: 3 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ cli
.option('--jsxFragment <jsxFragment>', 'Name of JSX fragment function', {
default: 'React.Fragment',
})
.option('--inlineDynamicImports', 'Create a single bundle that inlines dynamic imports')
.action(async (files: string[], options) => {
const { rollup, watch } = await import('rollup')
const { createRollupConfigs, printSizes } = await import('./')
Expand All @@ -43,7 +44,8 @@ cli
outDir: options.outDir,
define: options.define,
external: options.external,
moduleName: options.moduleName
moduleName: options.moduleName,
inlineDynamicImports: options.inlineDynamicImports
})
if (options.watch) {
const watcher = watch(
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type Options = {
}
/** Don't bundle these packages */
external?: string[]
inlineDynamicImports?: boolean
}

export async function createRollupConfigs(files: string[], options: Options) {
Expand All @@ -40,6 +41,7 @@ export async function createRollupConfigs(files: string[], options: Options) {
inputConfig: {
input: files,
preserveEntrySignatures: 'strict',
inlineDynamicImports: options.inlineDynamicImports,
onwarn(warning, handler) {
if (
warning.code === 'UNRESOLVED_IMPORT' ||
Expand Down

0 comments on commit d0b2433

Please sign in to comment.