16.0.0 changes the path handling and the following code fails to import files:
{
loader: 'sass-loader',
options: {
implementation: sass,
api: 'legacy', //Note: needed or paths are not passed!!!
//api: 'modern', //FIXME does not work (paths not found)
sassOptions: {
includePaths: themeBuilder.getSassIncludePaths()
},
additionalData: this.getSassVariables(themeBuilder)
}
In order to get the path to work api has to be set to 'legacy'. Modern is not working.
Bug report
16.0.0 changes the path handling and the following code fails to import files:
In order to get the path to work api has to be set to 'legacy'. Modern is not working.
apiType is here detected as modern:
https://github.com/webpack-contrib/sass-loader/blob/c7ca4ee0bbd7303c29211593028b595d430e96ad/src/index.js#L38
And here no path is passed:
https://github.com/webpack-contrib/sass-loader/blob/c7ca4ee0bbd7303c29211593028b595d430e96ad/src/index.js#L69
Legacy mode passes the import paths here:
https://github.com/webpack-contrib/sass-loader/blob/c7ca4ee0bbd7303c29211593028b595d430e96ad/src/index.js#L65
How can we set the import paths in modern mode?
Actual Behavior
Import paths ignored in modern mode, the new default mode.
Expected Behavior
Import paths should be used.
How Do We Reproduce?
See examples above.
Please paste the results of
npx webpack-cli info
here, and mention other relevant informationSystem: OS: macOS 14.5 CPU: (16) arm64 Apple M3 Max Memory: 3.30 GB / 64.00 GB Binaries: Node: 20.14.0 - ~/.nvm/versions/node/v20.14.0/bin/node Yarn: 1.22.22 - /opt/local/bin/yarn npm: 10.7.0 - ~/.nvm/versions/node/v20.14.0/bin/npm Browsers: Brave Browser: 96.1.32.113 Chrome: 127.0.6533.72 Edge: 127.0.2651.74 Safari: 17.5 Monorepos: Yarn Workspaces: 1.22.22 Packages: babel-loader: ^9.1.3 => 9.1.3 css-loader: ^7.1.2 => 7.1.2 sass-loader: ^16.0.0 => 16.0.0 style-loader: ^4.0.0 => 4.0.0 webpack: ^5.93.0 => 5.93.0 webpack-stream: ^7.0.0 => 7.0.0