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

New css2json-loader fails #1138

Open
1 task
crowmagnumb opened this issue May 15, 2020 · 0 comments
Open
1 task

New css2json-loader fails #1138

crowmagnumb opened this issue May 15, 2020 · 0 comments

Comments

@crowmagnumb
Copy link

crowmagnumb commented May 15, 2020

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.5.0

  • Cross-platform modules: 6.5.1

  • Android Runtime: 6.5.0

  • iOS Runtime: 6.5.0

  • Plugin(s):

  • Node.js: 12.7.0

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

I can't attach these because the file type of json and js is not allowed in the below attach file section. But they are in a public repo here. As is the scss file I'm showing here. You can actually just clone that repo and reproduce this problem for yourself by running (npm i; gulp dev:android) after replacing webpack.config.js with the version webpack.config.ORIG.js. The latter of which is really just tns run android --env.aot --no-hmr after compiling pug files to html files.

Describe the bug

The following scss file causes webpack.config.js to fail with ...

JS: Error: Could not load CSS from app.css: ReferenceError: undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefined is not defined
* {
    font-size: 16;
}

.bigger-font {
    font-size: 24;
}

.big-font {
    font-size: 19;
}

.centered {
    text-align: center;
}

.bold {
    font-weight: bold;
}

.width100 {
    width: 100%;
}

If you comment out the bottom three entries say then it works fine. Various other combinations of commenting out and in of different entries results in success or failure. Only difference being the number of "undefinedundefined...." values.

To Reproduce

See above.

Expected behavior

Not fail to compile bundle.

Sample project

See above.

Additional context

If I change the scss loader in the webpack.config.js file back to the css-loader it was on the last release I had installed, namely ...

diff --git a/webpack.config.js b/webpack.config.js
index f0b43bb..871928d 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -264,8 +264,8 @@ module.exports = env => {
                     use: [
                         "nativescript-dev-webpack/style-hot-loader",
                         {
-                            loader: "nativescript-dev-webpack/css2json-loader",
-                            options: { useForImports: true }
+                            loader: "css-loader",
+                            options: { url: false }
                         },
                         "sass-loader"
                     ]

... then it works fine. So that is what I am doing for now, reverting back to the old loader until this issue is resolved. Cheers.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant