-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
242 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body { | ||
background: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* eslint-disable import/no-unresolved */ | ||
// some file | ||
import './style.scss?00'; | ||
import './style.scss?01'; | ||
import './style.scss?02'; | ||
import './style.scss?03'; | ||
import './style.scss?04'; | ||
import './style.scss?05'; | ||
import './style.scss?06'; | ||
import './style.scss?07'; | ||
import './style.scss?08'; | ||
import './style.scss?09'; | ||
|
||
import './style.scss?10'; | ||
import './style.scss?11'; | ||
import './style.scss?12'; | ||
import './style.scss?13'; | ||
import './style.scss?14'; | ||
import './style.scss?15'; | ||
import './style.scss?16'; | ||
import './style.scss?17'; | ||
import './style.scss?18'; | ||
import './style.scss?19'; | ||
|
||
import './style.scss?20'; | ||
import './style.scss?21'; | ||
import './style.scss?22'; | ||
import './style.scss?23'; | ||
import './style.scss?24'; | ||
import './style.scss?25'; | ||
import './style.scss?26'; | ||
import './style.scss?27'; | ||
import './style.scss?28'; | ||
import './style.scss?29'; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"dependencies": { | ||
"lodash-es": "^4.17.14", | ||
"react": "^16.6.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import '_shared'; | ||
|
||
body { | ||
background: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
const path = require('path'); | ||
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); // eslint-disable-line import/no-extraneous-dependencies | ||
const threadLoader = require('../../src'); // eslint-disable-line import/no-extraneous-dependencies | ||
|
||
module.exports = (env) => { | ||
const workerPool = { | ||
workers: +env.threads, | ||
poolTimeout: env.watch ? Infinity : 2000, | ||
}; | ||
const workerPoolSass = { | ||
workers: +env.threads, | ||
workerParallelJobs: 2, | ||
poolTimeout: env.watch ? Infinity : 2000, | ||
}; | ||
if (+env.threads > 0) { | ||
threadLoader.warmup(workerPool, ['babel-loader', 'babel-preset-env']); | ||
threadLoader.warmup(workerPoolSass, ['sass-loader', 'css-loader']); | ||
} | ||
return { | ||
mode: 'none', | ||
context: __dirname, | ||
entry: ['./index.js'], | ||
output: { | ||
path: path.resolve('dist'), | ||
filename: 'bundle.js', | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
use: [ | ||
env.threads !== 0 && { | ||
loader: path.resolve(__dirname, '../../dist/index.js'), | ||
options: workerPool, | ||
}, | ||
'babel-loader', | ||
].filter(Boolean), | ||
}, | ||
{ | ||
test: /\.scss$/, | ||
use: [ | ||
MiniCssExtractPlugin.loader, | ||
env.threads !== 0 && { | ||
loader: path.resolve(__dirname, '../../dist/index.js'), | ||
options: workerPoolSass, | ||
}, | ||
'css-loader', | ||
'sass-loader', | ||
].filter(Boolean), | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new MiniCssExtractPlugin({ | ||
filename: 'style.css', | ||
}), | ||
], | ||
stats: { | ||
children: false, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import webpack from 'webpack'; | ||
import sassLoaderConfig from './sass-loader-example/webpack.config'; | ||
|
||
test("Processes sass-loader's @import correctly", (done) => { | ||
const config = sassLoaderConfig({}); | ||
webpack(config, (err, stats) => { | ||
// eslint-disable-next-line no-console | ||
if (err) console.error(err); | ||
expect(err).toBe(null); | ||
|
||
if (stats.hasErrors()) { | ||
// eslint-disable-next-line no-console | ||
console.error(stats.toJson().errors); | ||
} | ||
expect(stats.hasErrors()).toBe(false); | ||
done(); | ||
}); | ||
}, 30000); |