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

Cannot expose ts module since 1.0.0 #115

Closed
MhMadHamster opened this issue Sep 21, 2020 · 4 comments
Closed

Cannot expose ts module since 1.0.0 #115

MhMadHamster opened this issue Sep 21, 2020 · 4 comments

Comments

@MhMadHamster
Copy link

MhMadHamster commented Sep 21, 2020

  • Operating System: Windows 10
  • Node Version: 12.13
  • NPM Version: yarn 1.12.3
  • webpack Version: 4.44.2
  • expose-loader Version: 1.0.0

Expected Behavior

No errors when building project.

Actual Behavior

Error: Cannot read property 'hooks' of undefined occures when building project with exposed ts modules.

Code

// index.ts
function foo() {};

export default foo;

How Do We Reproduce?

Repo with example: https://github.com/MhMadHamster/webpack-expose-ts-modules

module.exports = {
  entry: "expose-loader?exposes=index!./index.ts",
  mode: "development",
  module: {
    rules: [
      {
        test: /\.ts$/,
        use: [
          "thread-loader",
          {
            loader: "ts-loader",
            options: {
              happyPackMode: true
            },
          },
        ],
      },
    ],
  },
}
@alexander-akait
Copy link
Member

Do not use loader in entry, it will be error in webpack@5

@MhMadHamster
Copy link
Author

@evilebottnawi It works currently for js files, so it dosent really make sense to me why js works just fine and ts is not working because of the changes in the next webpack major version. Also there was nothing about "consider not using loader for entries" in the changelog of 1.0.0.

@alexander-akait
Copy link
Member

Anyway bug in thread-loader, you can remove thread-loader and all works fine, can you open new issue in thread-loader?

@MhMadHamster
Copy link
Author

Sure, thanks.

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

2 participants