Typescript: nodeExtractor.requireEntrypoint returns undefined
See original GitHub issue💬 Questions and Help
Hi everybody,
first I want to thank you for the awesome piece of software you created. Now to my problem.
Problem
Based on the SSR example in this repo, I have created my own example here. The only difference: it is a TypeScript example.
I’ve got the problem, that
const { default: App } = nodeExtractor.requireEntrypoint('main')
always returns undefined
(here). Not sure why this happens and how I can fix it.
In my webpack config I use both babel-loader
and ts-loader
together with typescript-loadable-components-plugin
:
// webpack.config.js
module: {
rules: [
{
test: /\.(ts)x?$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
},
{
loader: 'ts-loader',
options: {
getCustomTransformers: (program) => ({
before: [createLoadableComponentsTransformer(program, {})],
}),
},
},
],
},
],
},
I noticed that I am also unable to use webpackChunkName
(the bundles get ascending numbers, e.g. 0.js
, 1.js
) but that’s another problem for another issue report https://github.com/acrazing/typescript-loadable-components-plugin/issues/3.
Could you please help me? Thank you very much. I appreciate every type of support.
Expected Result
SSR in a typescript app works similar to the JS example.
Example Repo
Related Issues
- https://github.com/gregberge/loadable-components/issues/189: I read it but couldn’t figure out what I need to do.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top GitHub Comments
Hi @theKashey,
FTR: I’ve also had to change the
libraryTarget
similar to the one in the example. Without this changeApp
was still undefined. So it was the combination of both I guess.I have no idea too ^^. I was just happy to find a solution 😄
@natterstefan thanks for the acknowledgment, much appreciated. ✌️