|
|
@@ -8,7 +8,15 @@ export default function SemiThemeLoader(source: string) {
|
|
|
const scssVarStr = `@import "~${theme}/scss/index.scss";\n`;
|
|
|
// inject once
|
|
|
const cssVarStr = `@import "~${theme}/scss/global.scss";\n`;
|
|
|
- const animationStr = `@import "~${theme}/scss/animation.scss";\n`;
|
|
|
+ let animationStr = `@import "~${theme}/scss/animation.scss";\n`;
|
|
|
+
|
|
|
+ try {
|
|
|
+ require.resolve(`${theme}/scss/animation.scss`);
|
|
|
+ } catch (e) {
|
|
|
+ animationStr = ""; // fallback to empty string
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
const shouldInject = source.includes('semi-base');
|
|
|
|
|
|
let fileStr = source;
|
|
|
@@ -16,7 +24,8 @@ export default function SemiThemeLoader(source: string) {
|
|
|
let componentVariables: string | boolean;
|
|
|
try {
|
|
|
componentVariables = resolve.sync(this.context, `${theme}/scss/local.scss`);
|
|
|
- } catch (e) {}
|
|
|
+ } catch (e) {
|
|
|
+ }
|
|
|
|
|
|
if (query.include || query.variables || componentVariables) {
|
|
|
let localImport = '';
|
|
|
@@ -36,7 +45,8 @@ export default function SemiThemeLoader(source: string) {
|
|
|
fileSplit.splice(fileSplit.length - 1, 0, localImport);
|
|
|
fileStr = fileSplit.join('');
|
|
|
}
|
|
|
- } catch (error) {}
|
|
|
+ } catch (error) {
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// inject prefix
|