fix: app-css-loader to look for platform specific app s?css files too

This commit is contained in:
Igor Randjelovic
2021-03-30 14:34:30 +02:00
parent 0999d6fe3e
commit f7530fe4e1
10 changed files with 73 additions and 19 deletions

View File

@@ -4,13 +4,16 @@ import { dedent } from 'ts-dedent';
* This loader tries to load an `app.scss` or and `app.css` relative to the main entry
*/
export default function loader(content: string, map: any) {
const { platform } = this.getOptions();
const callback = this.async();
const resolve = this.getResolve({
extensions: ['.scss', '.css'],
extensions: [`.${platform}.scss`, `.${platform}.css`, '.scss', '.css'],
});
resolve(this.context, './app', (err, res) => {
if (err || !res) {
// if we ran into an error or there's no css file found, we just return
// original content and not append any additional imports.
return callback(null, content, map);
}