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

With HappyPack #6

Closed
alteredtastes opened this issue Mar 8, 2018 · 5 comments
Closed

With HappyPack #6

alteredtastes opened this issue Mar 8, 2018 · 5 comments

Comments

@alteredtastes
Copy link

alteredtastes commented Mar 8, 2018

Hi there @Igorbek - I'm having some issues setting this up but my team would love to have this improved debugging experience. We are not using hot reloading and we have ts-loader v3.1.1 with HappyPack. My configuration currently looks like..

const createStyledComponentsTransformer = require('typescript-plugin-styled-components').default;
const styledComponentsTransformer = createStyledComponentsTransformer({options: getStyledComponentDisplay});

function getStyledComponentDisplay(filename, bindingName) {
    return bindingName || makePascalCase(filename);
}

// webpack plugins...
plugins {
   typescriptTranspiler: function(workers) {
      return new HappyPack({
         id: 'ts',
         threads: workers,
         loaders: [
            {
               path: 'ts-loader',
               query: { happyPackMode: true },
               options: {
                getCustomTransformers: () => ({before: [styledComponentsTransformer]})
               }
            }
         ]
      })
   }

Is there something you see that is missing or problematic in this usage? I am seeing the build succeed but still with no bindingName/filenames on the generated html. Thanks for any help!

@Igorbek
Copy link
Owner

Igorbek commented Mar 8, 2018

Hi, thank you for reporting.
Unfortunately, as far as I know, ts-loader did not implement that feature.
The issue is that when HappyPack/thread-loader forks processes it cannot serialize functions inside options. And since getCustomTransformers is a function, it is not transferred to a forked process.
awesome-typescript-loader has implemented a feature where getCustomTransformers can be a string that identifies a module that will be resolved in a forked process. That totally solves that issue there.
You can file the similar issue in ts-loader and refer to similar issue.

@alteredtastes
Copy link
Author

I see. I suppose I'll take this up in ts-loader. Thanks for reply!

@alteredtastes
Copy link
Author

Pending fix is in review thanks to @vagusX 🎉 👉 TypeStrong/ts-loader#745

@Igorbek
Copy link
Owner

Igorbek commented Mar 19, 2018

README has been updated with the instructions.

@Igorbek Igorbek closed this as completed Mar 19, 2018
@bernatfortet
Copy link

@alteredtastes did this ever work for me?
It's still an issue for me. HappyPack and Webpack load just fine but there's no effect on the className side.

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

No branches or pull requests

3 participants