Closed Logikgate closed 3 years ago
We finally isolated this to a change in css-loader v4. Adding the variables.scss file to the modules auto function fixed the issue for us. Updated webpack config is below for reference
{
test: /\.s[ac]ss$/,
exclude: /[\/|\\]app\.scss$/,
use: [
"@nativescript/webpack/helpers/style-hot-loader",
"@nativescript/webpack/helpers/apply-css-loader.js",
{
loader: "css-loader",
options: {
url: false,
modules: {
auto: (resourcePath) => resourcePath.endsWith("variables.scss")
}
}
},
{ loader: "sass-loader", options: { implementation: require("sass") } }
]
}
Environment Provide version numbers for the following components (information can be retrieved by running
tns info
in your project folder or by inspecting thepackage.json
of the project):CLI: 7.0.7
Cross-platform modules: 7.0.3
Android Runtime: 7.0
iOS Runtime: 7.0
Plugin(s):
Node.js: 12.12.0
[x] Please, attach your package.json and webpack.config.js as these configurations are usually critical for investigating issues with webpack
Describe the bug In our app we are using the :export modifier in a variables.scss file to be able to reference a few css variables within javascript/typescript files. Prior to updating to @nativescript/webpack from nativescript-webpack-dev the below configuration was working. Is there a change to the webpack config that would make this work again?
To Reproduce variables.scss
file.ts
webpack config
Expected behavior
The :export variables are accessible to javascript/typescript files that import the variables.scss file.
Additional context This the a console log of the entire variables object that gets imported.