Skip to content

Commit 3c7866e

Browse files
authored
fix(rollup-conf): styles dir location (#155)
Due to recent breaking changes in Rollup PostCSS plugin that I completely missed the styles dir has moved from the root to the bundle files and is now 4 times in the packages (4 copies of the same thing). This is not how it is documented and was never announced to the public as a breaking change. This commit reverses it to the way it used to be prior to the update. It also officially drops support for Rollup PostCSS plugin (dev dep in our projects) version 2 since the way paths are interpreted is different from the up to date version 3.
1 parent 1f31c3a commit 3c7866e

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"rollup-plugin-analyzer": "^3.2.0",
8888
"rollup-plugin-babel": "^4.3.0",
8989
"rollup-plugin-copy": "^3.3.0",
90-
"rollup-plugin-postcss": "^2.0.0 || ^3.0.0",
90+
"rollup-plugin-postcss": "^3.0.0",
9191
"rollup-plugin-terser": "^5.2.0",
9292
"rollup-plugin-typescript2": "^0.24.0 || ^0.26.0 || ^0.27.0"
9393
},

src/module/generate-rollup-configuration/index.ts

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -529,12 +529,14 @@ export function generateRollupConfiguration(
529529

530530
const commonOutputESM = {
531531
banner,
532+
dir: ".",
532533
format: "esm",
533534
globals: processGlobals(globals),
534535
sourcemap: true
535536
};
536537
const commonOutputUMD = {
537538
banner,
539+
dir: ".",
538540
exports: "named",
539541
extend: true,
540542
format: "umd",
@@ -555,8 +557,14 @@ export function generateRollupConfiguration(
555557
external: external.standalone,
556558
input: standaloneEntry,
557559
output: [
558-
{ ...commonOutputESM, file: `standalone/esm/${libraryFilename}.js` },
559-
{ ...commonOutputUMD, file: `standalone/umd/${libraryFilename}.js` }
560+
{
561+
...commonOutputESM,
562+
entryFileNames: `standalone/esm/${libraryFilename}.js`
563+
},
564+
{
565+
...commonOutputUMD,
566+
entryFileNames: `standalone/umd/${libraryFilename}.js`
567+
}
560568
],
561569
plugins: getPlugins("standalone", {
562570
injectCSS,
@@ -570,9 +578,12 @@ export function generateRollupConfiguration(
570578
output: [
571579
{
572580
...commonOutputESM,
573-
file: `standalone/esm/${libraryFilename}.min.js`
581+
entryFileNames: `standalone/esm/${libraryFilename}.min.js`
574582
},
575-
{ ...commonOutputUMD, file: `standalone/umd/${libraryFilename}.min.js` }
583+
{
584+
...commonOutputUMD,
585+
entryFileNames: `standalone/umd/${libraryFilename}.min.js`
586+
}
576587
],
577588
plugins: getPlugins("standalone", {
578589
injectCSS,
@@ -588,12 +599,12 @@ export function generateRollupConfiguration(
588599
output: [
589600
{
590601
...commonOutputESM,
591-
file: `peer/esm/${libraryFilename}.js`,
602+
entryFileNames: `peer/esm/${libraryFilename}.js`,
592603
paths: getPaths("peer")
593604
},
594605
{
595606
...commonOutputUMD,
596-
file: `peer/umd/${libraryFilename}.js`,
607+
entryFileNames: `peer/umd/${libraryFilename}.js`,
597608
paths: getPaths("peer")
598609
}
599610
],
@@ -608,12 +619,12 @@ export function generateRollupConfiguration(
608619
output: [
609620
{
610621
...commonOutputESM,
611-
file: `peer/esm/${libraryFilename}.min.js`,
622+
entryFileNames: `peer/esm/${libraryFilename}.min.js`,
612623
paths: getPaths("peer")
613624
},
614625
{
615626
...commonOutputUMD,
616-
file: `peer/umd/${libraryFilename}.min.js`,
627+
entryFileNames: `peer/umd/${libraryFilename}.min.js`,
617628
paths: getPaths("peer")
618629
}
619630
],
@@ -630,12 +641,12 @@ export function generateRollupConfiguration(
630641
output: [
631642
{
632643
...commonOutputESM,
633-
file: `esnext/esm/${libraryFilename}.js`,
644+
entryFileNames: `esnext/esm/${libraryFilename}.js`,
634645
paths: getPaths("esnext")
635646
},
636647
{
637648
...commonOutputUMD,
638-
file: `esnext/umd/${libraryFilename}.js`,
649+
entryFileNames: `esnext/umd/${libraryFilename}.js`,
639650
paths: getPaths("esnext")
640651
}
641652
],
@@ -649,12 +660,12 @@ export function generateRollupConfiguration(
649660
output: [
650661
{
651662
...commonOutputESM,
652-
file: `esnext/esm/${libraryFilename}.min.js`,
663+
entryFileNames: `esnext/esm/${libraryFilename}.min.js`,
653664
paths: getPaths("esnext")
654665
},
655666
{
656667
...commonOutputUMD,
657-
file: `esnext/umd/${libraryFilename}.min.js`,
668+
entryFileNames: `esnext/umd/${libraryFilename}.min.js`,
658669
paths: getPaths("esnext")
659670
}
660671
],

0 commit comments

Comments
 (0)