Skip to content

Commit d44922c

Browse files
committed
feat: infer development mode
1 parent 0745244 commit d44922c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/createConfig.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,19 @@ interface CreateConfigOptions {
128128
}
129129

130130
export default function createConfig(opts: Partial<CreateConfigOptions>): InputOptions {
131-
const minify = opts.minify === true;
131+
const DEV = process.env.ROLLUP_WATCH === "true";
132+
const minify = opts.minify === true || !DEV;
132133
const pkg = getPackageJSON();
133134
const hash = minify ? hashREADME() : "";
134135
const output_dir = opts.outDir || "dist";
135136

137+
console.log(`[createConfig] Running in ${DEV ? "development" : "production"}`);
138+
console.log("[createConfig] options:");
139+
console.group();
140+
console.log("minify:", minify);
141+
console.log("outDir:", output_dir);
142+
console.groupEnd();
143+
136144
const template = `
137145
<!DOCTYPE html>
138146
<html lang="en">
@@ -155,6 +163,7 @@ export default function createConfig(opts: Partial<CreateConfigOptions>): InputO
155163
`;
156164

157165
if (minify) fs.removeSync(output_dir);
166+
158167
fs.ensureFileSync(`${output_dir}/index.html`);
159168
fs.writeFileSync(
160169
`${output_dir}/index.html`,

test/rollup.config.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ const BUNDLE = process.env.BUNDLE === "true";
1010
export default () => {
1111
if (!BUNDLE)
1212
return svelteReadme({
13-
minify: !DEV,
14-
svelte: { compilerOptions: { immutable: true } },
1513
plugins: [
1614
DEV &&
1715
serve({

0 commit comments

Comments
 (0)