Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Css module import of local file doesn't work #1098

Closed
@Fatme

Description

@Fatme

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 6.2.x

  • Cross-platform modules: 6.2.x

  • Android Runtime: 6.2.x

  • iOS Runtime: 6.2.x

  • Plugin(s):

  • Node.js:

  • Please, attach your package.json and webpack.config.js as these configurations are usually critical for investigating issues with webpack

Describe the bug
The following syntax doesn't work anymore after updating to NativeScript 6.2:

@import 'common.css';

To Reproduce

  1. tns create myApp --ng
  2. cd myApp && cd src && touch common.css
  3. Open app.css and add @import 'common.css';
  4. tns run ios
    The following error will be shown:
ERROR in ./app.css
Module not found: Error: Can't resolve 'common.css' in '/Users/<myuser>/Work/nativescript-cli/scratch/myApp/src'
 @ ./app.css 3:53-141
 @ ../node_modules/nativescript-dev-webpack/load-application-css-angular.js
 @ ./main.ts
Executing webpack failed with exit code 2.

Expected behavior

The described syntax is working with NativeScript 6.1 and it should work with NativeScript 6.2. as well.

Additional context

Workaround:
The import should be changed with relative path e.g. @import './common.css'

It seems that after changing css-loader with css2json-loader, module imports of .css file doesn't work anymore and only relative imports are supported.

The issue is not reproduced with .scss files.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions