mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2025-12-06 02:30:47 -08:00
feat: use ts-import-plugin for lodash and material-ui
This commit is contained in:
parent
358b38f230
commit
c2282b7ed4
1 changed files with 58 additions and 0 deletions
|
|
@ -1,3 +1,5 @@
|
|||
const tsImportPluginFactory = require('ts-import-plugin');
|
||||
|
||||
module.exports = [
|
||||
// Add support for native node modules
|
||||
{
|
||||
|
|
@ -37,6 +39,62 @@ module.exports = [
|
|||
options: {
|
||||
name: '[name].[ext]',
|
||||
outputPath: 'fonts/',
|
||||
getCustomTransformers: () => ({
|
||||
before: [
|
||||
// lodash
|
||||
tsImportPluginFactory({
|
||||
style: false,
|
||||
libraryName: 'lodash',
|
||||
libraryDirectory: null,
|
||||
camel2DashComponentName: false,
|
||||
}),
|
||||
// material-ui
|
||||
transformerFactory({
|
||||
libraryName: '@material-ui/core',
|
||||
libraryDirectory: '',
|
||||
camel2DashComponentName: false,
|
||||
}),
|
||||
// svg-icons
|
||||
transformerFactory({
|
||||
libraryDirectory: (importName) => {
|
||||
const stringVec = importName
|
||||
.split(/([A-Z][a-z]+|[0-9]*)/)
|
||||
.filter((s) => s.length)
|
||||
.map((s) => s.toLocaleLowerCase());
|
||||
|
||||
return stringVec.reduce((acc, cur, index) => {
|
||||
if (index > 1) {
|
||||
return acc + '-' + cur;
|
||||
} else if (index === 1) {
|
||||
return acc + '/' + cur;
|
||||
}
|
||||
return acc + cur;
|
||||
}, '');
|
||||
},
|
||||
libraryName: '@material-ui/icons',
|
||||
style: false,
|
||||
camel2DashComponentName: false,
|
||||
}),
|
||||
// RXJS
|
||||
transformerFactory([
|
||||
{
|
||||
libraryDirectory: '../_esm5/internal/operators',
|
||||
libraryName: 'rxjs/operators',
|
||||
camel2DashComponentName: false,
|
||||
transformToDefaultImport: false,
|
||||
},
|
||||
{
|
||||
libraryDirectory: '../_esm5/internal/observable',
|
||||
libraryName: 'rxjs',
|
||||
camel2DashComponentName: false,
|
||||
transformToDefaultImport: false,
|
||||
},
|
||||
]),
|
||||
],
|
||||
}),
|
||||
compilerOptions: {
|
||||
module: 'es2015',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue