diff --git a/packages/ember-auto-import/ts/package.ts b/packages/ember-auto-import/ts/package.ts index c1a0fcae7..d6f8639ea 100644 --- a/packages/ember-auto-import/ts/package.ts +++ b/packages/ember-auto-import/ts/package.ts @@ -29,6 +29,8 @@ export interface Options { alias?: { [fromName: string]: string }; webpack?: Configuration; publicAssetURL?: string; + styleLoaderOptions?: Record; + cssLoaderOptions?: Record; forbidEval?: boolean; skipBabel?: { package: string; semverRange?: string }[]; watchDependencies?: (string | string[])[]; @@ -354,6 +356,16 @@ export default class Package { return url; } + get styleLoaderOptions(): Record | undefined { + // only apps (not addons) are allowed to set this + return this.isAddon ? undefined : this.autoImportOptions?.styleLoaderOptions; + } + + get cssLoaderOptions(): Record | undefined { + // only apps (not addons) are allowed to set this + return this.isAddon ? undefined : this.autoImportOptions?.cssLoaderOptions; + } + get forbidsEval(): boolean { // only apps (not addons) are allowed to set this, because it's motivated by // the apps own Content Security Policy. diff --git a/packages/ember-auto-import/ts/webpack.ts b/packages/ember-auto-import/ts/webpack.ts index ec07e66bb..04047ef12 100644 --- a/packages/ember-auto-import/ts/webpack.ts +++ b/packages/ember-auto-import/ts/webpack.ts @@ -188,7 +188,10 @@ export default class WebpackBundler extends Plugin implements Bundler { this.babelRule(stagingDir), { test: /\.css$/i, - use: ['eai-style-loader', 'eai-css-loader'], + use: [ + { loader: 'eai-style-loader', options: [...this.opts.packages].find(pkg => pkg.styleLoaderOptions) }, + { loader: 'eai-css-loader', options: [...this.opts.packages].find(pkg => pkg.cssLoaderOptions) }, + ], }, ], },