-
Notifications
You must be signed in to change notification settings - Fork 492
Const Enum undefined when imported from remote npm package in create-react-app project #356
Comments
Ok - this one is a bit more complex to explain, yet it's pretty straight forward.
What would you expect to be the output of this? ... Answer - something like: See the config snippets: create-react-app-typescript/packages/react-scripts/config/webpack.config.dev.js Lines 173 to 185 in e4b1f94
create-react-app-typescript/packages/react-scripts/config/webpack.config.dev.js Lines 228 to 238 in e4b1f94
Besides, I wouldn't recommend to use dev version of typescript (in your case, a dev version of 3.0) - they are too unstable for production usage, and in most cases don't provide all features scheduled for the particular version. See the more details discussion / explanation here: #348 |
Thanks for you prompt, insightful response. The problem is similar to what I guessed it would be, and you were very helpful pointing out the relevant code. For the record, the dev version of typescript was simply to rule out any issues within typescript; as I submitted this as a issue to the official typescript project as well. I will look at #348 and see if we can come up with a solution on our side. Really appreciate the feedback. 👍 |
Created a pull request that adds the ability to enable typescript processing for a node_modules folder. Please take a look, #358 |
Was experiencing this, too. From #348 (comment) I added the package to the webpack configs' // Compile .tsx?
{
test: /\.(ts|tsx)$/,
include: [ paths.appSrc, path.resolve('..', 'node_modules', '<package-name>') ],
use: [
{
loader: require.resolve('ts-loader'),
|
This is exactly what my pr did. However, because this is such a niche issue, we decided to fork instead of merging into master. |
@larrybotha @stephenkiers I'm encountering the same issue. Will you be submitting a PR to simply add the external lib to the include path? It seems like a reasonable add on to the config. |
How is this is a niche issue? All of I've got several libraries I use regularly that I'd rather import the TS sources directly from It was a shock to find an import resolving to |
Is this a bug report?
Yes
Can you also reproduce the problem with npm 4.x?
Yes
Which terms did you search for in User Guide?
enum, npm, import
Environment
here is the yarn.lock info
node -v
v10.5.0
yarn --version
1.7.0
Then, specify:
Steps to Reproduce
See attached github repro that is minimal reproduction
https://github.com/stephenkiers/TypescriptRepo1
Remote Package Code
Target Package Code
Expected Behavior
Target Package should print
Full Name
Actual Behavior
TEST
is undefined, so there isUncaught TypeError: Cannot read property 'MINOR' of undefined
Reproducible Demo
The text was updated successfully, but these errors were encountered: