Skip to content

Commit a1c79fc

Browse files
webpack: Deprecate redundant allowRuntime option (#208)
1 parent 884cb27 commit a1c79fc

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.changeset/proud-berries-kick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@vanilla-extract/webpack-plugin': patch
3+
---
4+
5+
Deprecate redundant `allowRuntime` option

packages/webpack-plugin/src/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ interface PluginOptions {
5858
test?: RuleSetRule['test'];
5959
outputCss?: boolean;
6060
externals?: any;
61+
/** @deprecated */
6162
allowRuntime?: boolean;
6263
}
6364
export class VanillaExtractPlugin {
@@ -71,12 +72,16 @@ export class VanillaExtractPlugin {
7172
test = cssFileFilter,
7273
outputCss = true,
7374
externals,
74-
allowRuntime = false,
75+
allowRuntime,
7576
} = options;
7677

78+
if (allowRuntime !== undefined) {
79+
console.warn('The "allowRuntime" option is deprecated.');
80+
}
81+
7782
this.test = test;
7883
this.outputCss = outputCss;
79-
this.allowRuntime = allowRuntime;
84+
this.allowRuntime = allowRuntime ?? false;
8085
this.childCompiler = new ChildCompiler(externals);
8186
}
8287

@@ -113,7 +118,7 @@ export class VanillaExtractPlugin {
113118
}
114119

115120
let errorMessage = chalk.red(
116-
`VanillaExtractPlugin: Styles detected outside of '.css.(ts/js)' files. You probably don't want this as these styles can't be statically extracted. If this is the desired behaviour, set 'allowRuntime: true'.`,
121+
`VanillaExtractPlugin: Styles detected outside of '.css.(ts/js)' files. These styles cannot be statically extracted.`,
117122
);
118123

119124
if (dependentResources.size > 0) {

0 commit comments

Comments
 (0)