Skip to content

Angular 14 build fails when importing css in source code from node modules #23273

@thaoula

Description

@thaoula

🐞 Bug report

Command (mark with an x)

  • new
  • [ x] build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, this worked in Angular 13.3.10 and prior Yes, the previous version in which this bug was not present was: ....

Description

A clear and concise description of the problem...

We are utilising 3rd party components Froala Editor and Fullcalendar where we import there css files in source code like the following -

In the case of Froala we do the following

import 'froala-editor/css/plugins/draggable.css';
import 'froala-editor/css/plugins/table.css';

In the case of Fullcalendar they may be doing inside their own component and the following issue has been added their repo -
fullcalendar/fullcalendar#6869

When running ng build you receive the following build error that look like the following -

./node_modules/@fullcalendar/common/main.css:4:0 - Error: Module parse failed: Unexpected token (4:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

🔬 Minimal Reproduction

🔥 Exception or Error

Error




./node_modules/@fullcalendar/common/main.css:4:0 - Error: Module parse failed: Unexpected token (4:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

./node_modules/froala-editor/css/plugins/table.css:7:0 - Error: Module parse failed: Unexpected token (7:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

🌍 Your Environment




Angular CLI: 14.0.0
Node: 18.2.0 (Unsupported)
Package Manager: npm 8.9.0 
OS: darwin arm64

Angular: 14.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic
... platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1400.0
@angular-devkit/build-angular   14.0.0
@angular-devkit/core            14.0.0
@angular-devkit/schematics      14.0.0
@angular/cdk                    13.0.0
@schematics/angular             14.0.0
rxjs                            7.5.5
typescript                      4.6.2

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions