Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for WebWorker with worker-loader (#3660) #3934

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Add support for WebWorker with worker-loader (#3660)

  • Loading branch information
iansu committed Jan 28, 2018
commit 2ec7eaa00702d0a4823b7c9078c10bfc00e73a40
@@ -213,6 +213,32 @@ module.exports = {
name: 'static/media/[name].[hash:8].[ext]',
},
},
// Process WebWorkder JS with Babel.

This comment has been minimized.

Copy link
@dijs

dijs Aug 5, 2018

Typo. WebWorkers

// The preset includes JSX, Flow, and some ESnext features.
{
test: /\.worker\.(js|jsx|mjs)$/,
include: paths.appSrc,
use: [
require.resolve('worker-loader'),
// This loader parallelizes code compilation, it is optional but
// improves compile time on larger projects
require.resolve('thread-loader'),
{
loader: require.resolve('babel-loader'),
options: {
// @remove-on-eject-begin
babelrc: false,
presets: [require.resolve('babel-preset-react-app')],
// @remove-on-eject-end
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
cacheDirectory: true,
highlightCode: true,
},
},
],
},
// Process application JS with Babel.
// The preset includes JSX, Flow, and some ESnext features.
{
@@ -252,6 +252,29 @@ module.exports = {
name: 'static/media/[name].[hash:8].[ext]',
},
},
// Process WebWorkder JS with Babel.
// The preset includes JSX, Flow, and some ESnext features.
{
test: /\.worker\.(js|jsx|mjs)$/,
include: paths.appSrc,
use: [
require.resolve('worker-loader'),
// This loader parallelizes code compilation, it is optional but
// improves compile time on larger projects
require.resolve('thread-loader'),
{
loader: require.resolve('babel-loader'),
options: {
// @remove-on-eject-begin
babelrc: false,
presets: [require.resolve('babel-preset-react-app')],
// @remove-on-eject-end
compact: true,
highlightCode: true,
},
},
],
},
// Process application JS with Babel.
// The preset includes JSX, Flow, and some ESnext features.
{
@@ -70,7 +70,8 @@
"webpack": "4.8.3",
"webpack-dev-server": "3.1.4",
"webpack-manifest-plugin": "2.0.3",
"whatwg-fetch": "2.0.4"
"whatwg-fetch": "2.0.4",
"worker-loader": "^1.1.1"
},
"devDependencies": {
"react": "^16.3.2",
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.