@@ -54,20 +54,17 @@ async function main() {
54
54
...( packageData ?. config ?. css_source ? [ packageData . config . css_source ] : [ ] ) ,
55
55
] ;
56
56
57
- const peerDependencies = [
58
- '@hotwired/stimulus' ,
59
- ...( packageData . peerDependencies ? Object . keys ( packageData . peerDependencies ) : [ ] ) ,
60
- ] ;
57
+ const external = [ ] ;
61
58
62
59
inputFiles . forEach ( ( file ) => {
63
60
// custom handling for StimulusBundle
64
61
if ( file . includes ( 'StimulusBundle/assets/src/loader.ts' ) ) {
65
- peerDependencies . push ( './controllers.js' ) ;
62
+ external . push ( './controllers.js' ) ;
66
63
}
67
64
68
65
// React, Vue
69
66
if ( file . includes ( 'assets/src/loader.ts' ) ) {
70
- peerDependencies . push ( './components.js' ) ;
67
+ external . push ( './components.js' ) ;
71
68
}
72
69
} ) ;
73
70
@@ -78,7 +75,7 @@ async function main() {
78
75
outputOptions : {
79
76
cssEntryFileNames : '[name].min.css' ,
80
77
} ,
81
- external : peerDependencies ,
78
+ external,
82
79
format : 'esm' ,
83
80
platform : 'browser' ,
84
81
tsconfig : path . join ( import . meta. dirname , '../tsconfig.packages.json' ) ,
@@ -87,38 +84,6 @@ async function main() {
87
84
target : 'es2021' ,
88
85
watch : isWatch ,
89
86
plugins : [
90
-
91
- /**
92
- * Guarantees that any files imported from a peer dependency are treated as an external.
93
- *
94
- * For example, if we import `chart.js/auto`, that would not normally
95
- * match the "chart.js" we pass to the "externals" config. This plugin
96
- * catches that case and adds it as an external.
97
- *
98
- * Inspired by https://github.com/oat-sa/rollup-plugin-wildcard-external
99
- */
100
- {
101
- name : 'wildcard-externals' ,
102
- resolveId ( source : string , importer : string ) {
103
- if ( ! importer ) {
104
- return null ; // other ids should be handled as usually
105
- }
106
-
107
- const matchesExternal = peerDependencies . some ( ( peerDependency ) => {
108
- return source . includes ( `/${ peerDependency } /` )
109
- } ) ;
110
-
111
- if ( matchesExternal ) {
112
- return {
113
- id : source ,
114
- external : true ,
115
- moduleSideEffects : true ,
116
- } ;
117
- }
118
-
119
- return null ; // other ids should be handled as usually
120
- } ,
121
- } ,
122
87
// Since minifying files is not configurable per file, we need to use a custom plugin to handle CSS minification.
123
88
{
124
89
name : 'minimize-css' ,
0 commit comments