File tree Expand file tree Collapse file tree 4 files changed +16
-6
lines changed
Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 88 "scripts" : {
99 "dev" : " NODE_NO_WARNINGS=1 storybook dev -p 6006 --no-open" ,
1010 "build:storybook" : " storybook build --debug" ,
11+ "build:bundler" : " yarn workspace @macrostrat/web-components-bundler run build" ,
1112 "build" : " NODE_NO_WARNINGS=1 tsx scripts/publish-helpers build" ,
1213 "status" : " NODE_NO_WARNINGS=1 tsx scripts/publish-helpers status" ,
1314 "prepare" : " NODE_NO_WARNINGS=1 tsx scripts/publish-helpers prepare" ,
Original file line number Diff line number Diff line change 33 "version" : " 0.3.0" ,
44 "description" : " Style system for Macrostrat" ,
55 "main" : " dist/style-system.css" ,
6+ "type" : " module" ,
67 "source" : " src/index.ts" ,
78 "scripts" : {
8- "build" : " vite build"
9+ "build" : " vite build"
910 },
1011 "dependencies" : {
1112 "@blueprintjs/core" : " ^6.6.1"
Original file line number Diff line number Diff line change 1- import { resolve } from "path" ;
1+ import { resolve , dirname } from "node: path" ;
22import { defineConfig } from "vite" ;
3+ import { fileURLToPath } from "node:url" ;
4+
5+ const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
36
47export default defineConfig ( {
8+ root : __dirname ,
59 build : {
610 minify : false ,
711 emptyOutDir : true ,
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ function buildStandardViteConfig(
6363 /** Build a standardized vite configuration for packages */
6464
6565 const verbose = opts . verbose ?? false ;
66+
6667 const packageNameWithoutScope = pkg . name . replace ( / ^ @ [ ^ / ] + \/ / , "" ) ;
6768
6869 const pkgData = { ...pkg , directory : root } ;
@@ -108,11 +109,14 @@ function buildStandardViteConfig(
108109 cssFileName : packageNameWithoutScope ,
109110 fileName : ( format , entryName ) => {
110111 // Place ES modules at root and CJS in /cjs subdirectory
111- entryName = entryName . replace ( prefix , format ) ;
112112
113- const prefixToRemove = format + "/" ;
114- if ( entryName . startsWith ( prefixToRemove ) ) {
115- entryName = entryName . slice ( prefixToRemove . length ) ;
113+ // Remove prefixes
114+ for ( const splitPart of [ "node_modules" , prefix ] ) {
115+ const partWithSlashes = splitPart + "/" ;
116+ if ( entryName . includes ( partWithSlashes ) ) {
117+ const parts = entryName . split ( partWithSlashes ) ;
118+ entryName = parts [ parts . length - 1 ] ;
119+ }
116120 }
117121
118122 return `${ entryName } .${ format === "es" ? "js" : "cjs" } ` ;
You can’t perform that action at this time.
0 commit comments