Closed minimit closed 4 days ago
With this options:
const rootDir = path.join(__dirname, '.build') { loader: 'sass-loader', options: { additionalData: `$rootDir: ${rootDir};`, }, },
Webpack fails with this error:
ERROR in ./src/test.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[0].use[2]!./src/test.scss) Module build failed (from ./node_modules/sass-loader/dist/cjs.js): Expected digit. ╷ 1 │ $rootDir: /Users/riccardocaroli/Documents/Apache/www/_libraries/webpack-sass-loader-bug/.build; │ ^ ╵ src/test.scss 1:90 root stylesheet @ ./src/test.scss 8:6-167 20:17-24 24:0-137 24:0-137 25:22-29 25:33-47 25:50-64 @ ./src/app.js 1:0-20
Webpack should compile and not give error, if you use const rootDir = path.join(__dirname, 'build') without the dot it works.
const rootDir = path.join(__dirname, 'build')
Minimal reproduction here https://github.com/webgriffe/webpack-sass-loader-bug
npx webpack-cli info
$rootDir: ${rootDir}; -> $rootDir: ${JSON.stringify(rootDir)};, by inserting a value you break the sass tokenizer
$rootDir: ${rootDir};
$rootDir: ${JSON.stringify(rootDir)};
Bug report
Actual Behavior
With this options:
Webpack fails with this error:
Expected Behavior
Webpack should compile and not give error, if you use
const rootDir = path.join(__dirname, 'build')
without the dot it works.How Do We Reproduce?
Minimal reproduction here https://github.com/webgriffe/webpack-sass-loader-bug
Please paste the results of
npx webpack-cli info
here, and mention other relevant information