File tree Expand file tree Collapse file tree 5 files changed +39
-1
lines changed Expand file tree Collapse file tree 5 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 141141# typescript tsbuildinfo
142142* .tsbuildinfo
143143lodashReplacer.js
144+ muiReplacer.js
144145
Original file line number Diff line number Diff line change 1616 " src"
1717 ],
1818 "scripts" : {
19- "build:ts" : " tsc -b tsconfig.build.json && tsc-alias -p tsconfig.build.json" ,
19+ "compileReplacer" : " tsc -p tsconfig.replacer.json" ,
20+ "build:ts" : " npm run compileReplacer && rimraf ./lib && tsc -b tsconfig.build.json && tsc-alias -p tsconfig.build.json" ,
2021 "build:cjs" : " esbuild ./src/index.ts --bundle --outfile=dist/index.js --sourcemap --packages=external --format=cjs" ,
2122 "build:esm" : " esbuild ./src/index.ts --bundle --outfile=dist/mui.esm.js --sourcemap --packages=external --format=esm" ,
2223 "build:umd" : " rollup dist/mui.esm.js --format=umd --file=dist/mui.umd.js --name=@rjsf/mui" ,
Original file line number Diff line number Diff line change 1212 "tsc-alias" : {
1313 "resolveFullPaths" : true ,
1414 "verbose" : true ,
15+ "replacers" : {
16+ "lodash" : {
17+ "enabled" : true ,
18+ "file" : " muiReplacer.js"
19+ }
20+ }
1521 }
1622}
Original file line number Diff line number Diff line change 1+ {
2+ "compilerOptions" : {
3+ "module" : " commonjs" ,
4+ "target" : " es2017" ,
5+ "outDir" : " ./" ,
6+ "skipLibCheck" : true ,
7+ },
8+ "files" : [
9+ " ../../tsc-alias-replacer/muiReplacer.ts"
10+ ],
11+ "exclude" : [
12+ " ./src" ,
13+ " ./test"
14+ ]
15+ }
Original file line number Diff line number Diff line change 1+ import { AliasReplacerArguments } from 'tsc-alias' ;
2+
3+ /** A `tsc-alias` replacer that fixes up the imports `from 'lodash/xxxx'` to be `from `lodash/xxxx.js`
4+ *
5+ * @param orig - The original import name
6+ */
7+ export default function exampleReplacer ( { orig } : AliasReplacerArguments ) : string {
8+ if ( orig . startsWith ( "from '@mui/material/" ) ) {
9+ const origMinusEndQuote = orig . substring ( 0 , orig . length - 1 ) ;
10+ // console.log(origMinusEndQuote);
11+ return `${ origMinusEndQuote } /index.js'` ;
12+ }
13+
14+ return orig ;
15+ }
You can’t perform that action at this time.
0 commit comments