Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ exports[`angular configuration for android 1`] = `
},
/* config.module.rule('css') */
{
test: /\\\\.css$/,
exclude: [
/\\\\.component(\\\\.\\\\w+)?\\\\.css$/
],
test: /app(\\\\.\\\\w+)?\\\\.css$/,
use: [
/* config.module.rule('css').use('apply-css-loader') */
{
Expand All @@ -154,10 +151,7 @@ exports[`angular configuration for android 1`] = `
},
/* config.module.rule('scss') */
{
test: /\\\\.scss$/,
exclude: [
/\\\\.component(\\\\.\\\\w+)?\\\\.scss$/
],
test: /app(\\\\.\\\\w+)?\\\\.scss$/,
use: [
/* config.module.rule('scss').use('apply-css-loader') */
{
Expand Down Expand Up @@ -213,7 +207,10 @@ exports[`angular configuration for android 1`] = `
},
/* config.module.rule('css|component') */
{
test: /\\\\.component(\\\\.\\\\w+)?\\\\.css$/,
test: /\\\\.css$/,
exclude: [
/app(\\\\.\\\\w+)?\\\\.css$/
],
use: [
/* config.module.rule('css|component').use('raw-loader') */
{
Expand All @@ -223,7 +220,10 @@ exports[`angular configuration for android 1`] = `
},
/* config.module.rule('scss|component') */
{
test: /\\\\.component(\\\\.\\\\w+)?\\\\.scss$/,
test: /\\\\.scss$/,
exclude: [
/app(\\\\.\\\\w+)?\\\\.scss$/
],
use: [
/* config.module.rule('scss|component').use('raw-loader') */
{
Expand Down Expand Up @@ -499,10 +499,7 @@ exports[`angular configuration for ios 1`] = `
},
/* config.module.rule('css') */
{
test: /\\\\.css$/,
exclude: [
/\\\\.component(\\\\.\\\\w+)?\\\\.css$/
],
test: /app(\\\\.\\\\w+)?\\\\.css$/,
use: [
/* config.module.rule('css').use('apply-css-loader') */
{
Expand All @@ -527,10 +524,7 @@ exports[`angular configuration for ios 1`] = `
},
/* config.module.rule('scss') */
{
test: /\\\\.scss$/,
exclude: [
/\\\\.component(\\\\.\\\\w+)?\\\\.scss$/
],
test: /app(\\\\.\\\\w+)?\\\\.scss$/,
use: [
/* config.module.rule('scss').use('apply-css-loader') */
{
Expand Down Expand Up @@ -586,7 +580,10 @@ exports[`angular configuration for ios 1`] = `
},
/* config.module.rule('css|component') */
{
test: /\\\\.component(\\\\.\\\\w+)?\\\\.css$/,
test: /\\\\.css$/,
exclude: [
/app(\\\\.\\\\w+)?\\\\.css$/
],
use: [
/* config.module.rule('css|component').use('raw-loader') */
{
Expand All @@ -596,7 +593,10 @@ exports[`angular configuration for ios 1`] = `
},
/* config.module.rule('scss|component') */
{
test: /\\\\.component(\\\\.\\\\w+)?\\\\.scss$/,
test: /\\\\.scss$/,
exclude: [
/app(\\\\.\\\\w+)?\\\\.scss$/
],
use: [
/* config.module.rule('scss|component').use('raw-loader') */
{
Expand Down
22 changes: 16 additions & 6 deletions packages/webpack5/src/configuration/angular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,18 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
// exclude component css files from the normal css rule
config.module
.rule('css')
.exclude // exclude *.component.{platform}.css
.add(/\.component(\.\w+)?\.css$/);
.include.add(resolve(getEntryDirPath(), 'app.css'))
.add(resolve(getEntryDirPath(), `app.${platform}.css`))
.add(/node_modules/);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edusperoni This would I believe include all files in node_modules, since there's no extension checking.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rigor789 doesn't it extend from the base rule which does test for the extension?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah you are right, for some reason I thought we had deleted the base rule.


// and instead use raw-loader, since that's what angular expects
config.module
.rule('css|component')
.test(/\.component(\.\w+)?\.css$/)
.exclude.add(resolve(getEntryDirPath(), 'app.css'))
.add(resolve(getEntryDirPath(), `app.${platform}.css`))
.add(/node_modules/)
.end()
.test(/\.css$/)
.use('raw-loader')
.loader('raw-loader');

Expand All @@ -71,13 +76,18 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
// exclude component css files from the normal css rule
config.module
.rule('scss')
.exclude // exclude *.component.{platform}.scss
.add(/\.component(\.\w+)?\.scss$/);
.include.add(resolve(getEntryDirPath(), 'app.scss'))
.add(resolve(getEntryDirPath(), `app.${platform}.scss`))
.add(/node_modules/);

// and instead use raw-loader, since that's what angular expects
config.module
.rule('scss|component')
.test(/\.component(\.\w+)?\.scss$/)
.exclude.add(resolve(getEntryDirPath(), 'app.css'))
.add(resolve(getEntryDirPath(), `app.${platform}.css`))
.add(/node_modules/)
.end()
.test(/\.scss$/)
.use('raw-loader')
.loader('raw-loader')
.end()
Expand Down