lwd-technology / react-app-rewire-typescript Goto Github PK
View Code? Open in Web Editor NEWAdd ts-loader to a react-app-rewired config.
License: MIT License
Add ts-loader to a react-app-rewired config.
License: MIT License
Basically, there needs to be the tsconfig-paths-webpack-plugin added to handle this gracefully. See create-react-app-typescript using it.
Failed to compile.
Module not found: Error: Can't resolve '\src\index' in '\'
error Command failed with exit code 1.
https://github.com/lwd-technology/react-app-rewire-typescript/blob/master/index.js#L67
I'm pretty sure this is where the problem comes from
I'm using latest create-react-app:
const rewireTypescript = require('react-app-rewire-typescript')
module.exports = function override(config, env) {
config = rewireTypescript(config, env)
return config
}
C:\projects\my-app>npm start
> [email protected] start C:\projects\my-app
> react-app-rewired start
C:\projects\my-app\node_modules\react-app-rewire-typescript\index.js:41
const { index, rules } = findIndexAndRules(rulesSource, ruleMatcher)
^
TypeError: Cannot match against 'undefined' or 'null'.
at addBeforeRule (C:\projects\my-app\node_modules\react-app-rewire-typescript\index.js:41:28)
at rewireTypescript (C:\projects\my-app\node_modules\react-app-rewire-typescript\index.js:87:3)
at override (C:\projects\my-app\config-overrides.js:22:12)
at Object.<anonymous> (C:\projects\my-app\node_modules\react-app-rewired\scripts\start.js:16:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:423:7)
at startup (bootstrap_node.js:147:9)
at bootstrap_node.js:538:3
I am confused of where should I put outDir
in the configuration so will be great if you could add some basic setup that people could follow
P.S: this is my first time with Typescript so basically this would help beginners ๐ฐ
Thank you for creating this plugin, I successfully integrated it with create-react-app
and antd
. However when I'm running the tests, files with *.test.ts
are not being detected.
Here is my package.json scripts
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test --env=jsdom",
"eject": "react-app-rewired eject"
},
Is there an extra step I need to do?
getBabelLoader() throws an error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.