File tree Expand file tree Collapse file tree
packages/webpack-plugin/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' @vanilla-extract/webpack-plugin ' : patch
3+ ' @vanilla-extract/next-plugin ' : patch
4+ ---
5+
6+ Fixes a bug where the ` externals ` option was silently ignored
Original file line number Diff line number Diff line change 11import type { LoaderContext } from './types' ;
22import createCompat from './compat' ;
33
4- // Should be "ExternalsItem" but webpack doesn't expose it
4+ // Webpack exposes the `Externals` type which is a union of several types.
5+ // We likely intended to only accept a subset of these, but chose to use `any`.
6+ // We handle potential array inputs, but really we should be more specific about what we accept
7+ // here, or handling all types. Changing this type would be a breaking change,
8+ // so we can look at this in a future major release.
59type Externals = any ;
610
711interface CompilationResult {
@@ -131,7 +135,7 @@ function compileVanillaSource(
131135 new ExternalsPlugin ( 'commonjs' , [
132136 '@vanilla-extract/css' ,
133137 '@vanilla-extract/css/fileScope' ,
134- externals ,
138+ ... ( Array . isArray ( externals ) ? externals : [ externals ] ) ,
135139 ] ) . apply ( childCompiler ) ;
136140
137141 let source : string ;
Original file line number Diff line number Diff line change @@ -57,6 +57,10 @@ export interface PluginOptions {
5757 test ?: RuleSetRule [ 'test' ] ;
5858 identifiers ?: IdentifierOption ;
5959 outputCss ?: boolean ;
60+ /**
61+ * Effectively `ExternalItem[]` from webpack. Currently typed as `any` as this type was
62+ * previously not exposed. The `any` type will be fixed in the next major version.
63+ */
6064 externals ?: any ;
6165 /** @deprecated */
6266 allowRuntime ?: boolean ;
Original file line number Diff line number Diff line change @@ -76,6 +76,14 @@ const withVanillaExtract = createVanillaExtractPlugin({
7676
7777Each integration will set a default value based on the configuration options passed to the bundler.
7878
79+ ### externals
80+
81+ Effectively [ ` ExternalItem[] ` ] from webpack.
82+ Currently typed as ` any ` as this type was previously not exposed.
83+ The ` any ` type will be fixed in the next major version.
84+
85+ [ ` ExternalItem[] ` ] : https://github.com/webpack/webpack/blob/9211be0f7a04feb45e1074e6cf848a657dd82ebc/declarations/WebpackOptions.d.ts#L207-L211
86+
7987### unstable_turbopack
8088
8189> ⚠️  ;  ; Turbopack support is experimental. Its API is unstable and may undergo breaking changes in non-major versions. Additionally, it may not handle all features supported by Next.js.
Original file line number Diff line number Diff line change @@ -102,3 +102,11 @@ new VanillaExtractPlugin({
102102```
103103
104104Each integration will set a default value based on the configuration options passed to the bundler.
105+
106+ ### externals
107+
108+ Effectively [ ` ExternalItem[] ` ] from webpack.
109+ Currently typed as ` any ` as this type was previously not exposed.
110+ The ` any ` type will be fixed in the next major version.
111+
112+ [ ` ExternalItem[] ` ] : https://github.com/webpack/webpack/blob/9211be0f7a04feb45e1074e6cf848a657dd82ebc/declarations/WebpackOptions.d.ts#L207-L211
You can’t perform that action at this time.
0 commit comments