feat: app-css-loader & suppress env warning in ng projects

This commit is contained in:
Igor Randjelovic
2021-03-29 22:17:29 +02:00
parent 7d5f4a48ac
commit 0999d6fe3e
11 changed files with 105 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
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 callback = this.async();
const resolve = this.getResolve({
extensions: ['.scss', '.css'],
});
resolve(this.context, './app', (err, res) => {
if (err || !res) {
return callback(null, content, map);
}
const code = dedent`
// Added by app-css-loader
import "${res}";
${content}
`;
callback(null, code, map);
});
}