Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

Posibility for importing js modules #73

Closed
discoverr opened this issue May 25, 2017 · 6 comments
Closed

Posibility for importing js modules #73

discoverr opened this issue May 25, 2017 · 6 comments

Comments

@discoverr
Copy link

I am currently using this awesome package in order to have typescript without sacrificing the benefits of create-react-app.

Even though i would love to refactor all of our code to TypeScript we dont have the ability to do so. Instead we were trying to make declaretion files for the modules we kept as es6. But when we tried to import the es6 module the code was not transpiled.

Could we somehow allow the package to keep the standard babel config for .js files :-) ?

@bryanmig
Copy link

There is another issue open (#60) for converting to use at-loader instead and that has built in support for using Babel. Before I learned about this CRA fork, I was using it successfully in an ejected CRA with a setup that sounds like what youre looking for.

See description at https://github.com/s-panferov/awesome-typescript-loader

@FredrikNoren
Copy link

FredrikNoren commented May 25, 2017

@bryanmig will this also fix jest test js importing? I think I'm running into this issue right now, when requiring a .js file with a .d.ts declaration in jest test I just get the name of file back. I.e. import * as X from './x' X is now just "x.js".

@bryanmig
Copy link

I'm sorry - I dont recall having that same problem so I'm not sure if it will be resolved.

@discoverr
Copy link
Author

discoverr commented Jun 9, 2017

Even though createing a custom build config would solve my issue, it might be a nice implementation in create-react-app-typescript :-) ?

@rluiten
Copy link

rluiten commented Jul 4, 2017

I have a generated peg.js parser I want to use in a parser.js file.
I imported it into one of my components and it appears to import fine and lets me run it in my browser in dev mode.

I then added a test spec for it so I could setup a few test cases for the parser and find that no matter what I do cant get more the name of the module "parser.js" as the result of import parser = require('./parser.js');

Is there anything I can do that might let me get tests going ?

Its been a while since I've worked much with typescript and I am still quite new to CRA so not sure I can contribute much to actually work on create-react-app-typescript itself to help address the behavior I am seeing.

@wmonk
Copy link
Owner

wmonk commented Aug 7, 2017

As this hasn't been updated for a while, I am closing this issue. Please re-open if we have an update.

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

No branches or pull requests

4 participants