You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
works however previously it worked without this;
this gets fixed if file-loader's esModule is set to false which i did using a custom angular-builders/custom-webpack like this
of course it can be fixed adding this change in packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts i might check this later and add a PR
While using require() for images does work, this isn't something we've ever explicitly supported. Instead, Webpack, which we use, supports it, and we don't prevent its usage. In general we don't encourage or support using non-standard and webpack-specific features directly in user source code, because we don't want to commit to supporting them in case we change to other build setups.
In this case changing your require usage sounds like the right approach because otherwise we'd be half-heartedly trying to support something we don't support in the first place, and might even break other supported cases while trying.
🐞 Bug report
Command (mark with an
x
)Is this a regression?
Yes, the previous version in which this bug was not present was: angular & cli <9.1.0Description
binding image [src] to a source using "require()" longer works unless ".default' suffix is present;
ex:
🔬 Minimal Reproduction
ng new test-app curl -Ll https://upload.wikimedia.org/wikipedia/commons/e/e8/Heraldic_Sun.svg -o ./test-app/src/app/sun.svg cd test-app ng serve
and replace app.component.html with
🔥 Exception or Error
there will be no exception however rather than requiring the img a request to http://localhost:4200/[object%20Module]
will be made;
changing the require like this:
works however previously it worked without this;
this gets fixed if file-loader's esModule is set to false which i did using a custom angular-builders/custom-webpack like this
🌍 Your Environment
Anything else relevant?
of course it can be fixed adding this change in packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts i might check this later and add a PR
vue had smth similar
The text was updated successfully, but these errors were encountered: