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

improve initial build times using happypack #1090

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

amireh
Copy link

@amireh amireh commented Apr 10, 2016

Enables parallel loader application for jsx, json, sass, and less
sources using five background threads.

Some env notes:

  • you can disable HappyPack entirely by setting HAPPY=0 in your env
  • you can disable HappyPack's caching by setting HAPPY_CACHE=0
  • you can make HappyPack more verbose by setting HAPPY_VERBOSE=1 (useful
    to see the state of cache)
  • HappyPack's state and cache can be reset by rm -r .happypack/

Other minor changes:

  • made those loaders only apply to files under /src (a whitelist)

@amireh
Copy link
Author

amireh commented Apr 10, 2016

I would also suggest using eval as a devtool instead of inline-source-map as the former is much faster and works just fine for development purposes.

@igoldny
Copy link

igoldny commented Apr 12, 2016

looks good, json files broken tho.
try to import json file in your code you will get an error.

@mmahalwy
Copy link

Happypack is awesome! My only concern is sourcemaps.

@amireh
Copy link
Author

amireh commented Apr 12, 2016

@igoldny will take a look, created a ticket for it: amireh/happypack#30

@mmahalwy I've a ticket (amireh/happypack#28) open for source-map support, just need to find some time to tackle it.

@oyeanuj
Copy link

oyeanuj commented Jun 18, 2016

@amireh does this PR need to be updated given that source-map support is there now?

amireh added 2 commits June 18, 2016 11:46
Enables parallel loader application for jsx, json, sass, and less
sources using five background threads.

Some env notes:

- you can disable HappyPack entirely by setting HAPPY=0 in your env
- you can disable HappyPack's caching by setting HAPPY_CACHE=0
- you can make HappyPack more verbose by setting HAPPY_VERBOSE=1 (useful
  to see the state of cache)
- HappyPack's state and cache can be reset by `rm -r .happypack/`

Other minor changes:

- made those loaders only apply to files under `/src` (a whitelist)
@amireh amireh force-pushed the happypack-integration branch from a0daa6b to 879139a Compare June 18, 2016 09:08
@amireh
Copy link
Author

amireh commented Jun 18, 2016

@oyeanuj Yes, just did the upgrade and re-tested.

I also went over the reported json-loader issue and was not able to reproduce, there's now an example/test for json-loader and it seems to function correctly.

@oyeanuj
Copy link

oyeanuj commented Jun 18, 2016

@amireh Thanks for the update. I was trying it out and the only issue I ran into was when I was trying to expand it to include css (instead of sass). Following exactly how 'sass' loader was configured, I got the following errors.

Any thoughts on this? Let me know if I should move this conversation to the happypack repo instead?

assert.js:90
[0]   throw new assert.AssertionError({
[0]   ^
[0] AssertionError: HappyPlugin[css]; you have not specified any loaders and there is no matching loader entry with this id either.

In module.exports:

createSourceLoader({
    happy: { id: 'sass' },
    test: /\.scss$/,
    loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap',
    }),
createSourceLoader({
    happy: { id: 'css '},
    test: /\.css$/,
    loader: 'style!css?importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]'
}),

In plugins array:

createHappyPlugin('sass'),
createHappyPlugin('css')

@oyeanuj
Copy link

oyeanuj commented Jun 18, 2016

Actually, ignore my question above. Once I changed devtool to eval, it started working. Oh well~!

{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.less$/, loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!less?outputStyle=expanded&sourceMap' },
{ test: /\.scss$/, loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap' },
{ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this one was completely removed?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No woff and woff2 are replaced by the woff2? regex

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I missed that! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants