@@ -54,20 +54,17 @@ async function main() {
5454 ...( packageData ?. config ?. css_source ? [ packageData . config . css_source ] : [ ] ) ,
5555 ] ;
5656
57- const peerDependencies = [
58- '@hotwired/stimulus' ,
59- ...( packageData . peerDependencies ? Object . keys ( packageData . peerDependencies ) : [ ] ) ,
60- ] ;
57+ const external = [ ] ;
6158
6259 inputFiles . forEach ( ( file ) => {
6360 // custom handling for StimulusBundle
6461 if ( file . includes ( 'StimulusBundle/assets/src/loader.ts' ) ) {
65- peerDependencies . push ( './controllers.js' ) ;
62+ external . push ( './controllers.js' ) ;
6663 }
6764
6865 // React, Vue
6966 if ( file . includes ( 'assets/src/loader.ts' ) ) {
70- peerDependencies . push ( './components.js' ) ;
67+ external . push ( './components.js' ) ;
7168 }
7269 } ) ;
7370
@@ -78,7 +75,7 @@ async function main() {
7875 outputOptions : {
7976 cssEntryFileNames : '[name].min.css' ,
8077 } ,
81- external : peerDependencies ,
78+ external,
8279 format : 'esm' ,
8380 platform : 'browser' ,
8481 tsconfig : path . join ( import . meta. dirname , '../tsconfig.packages.json' ) ,
@@ -87,38 +84,6 @@ async function main() {
8784 target : 'es2021' ,
8885 watch : isWatch ,
8986 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- } ,
12287 // Since minifying files is not configurable per file, we need to use a custom plugin to handle CSS minification.
12388 {
12489 name : 'minimize-css' ,
0 commit comments