Comments (8)
Ran into this issue when tried to disable sourcemaps completely.
Looks like when "sourceMap": false
is present in tsconfig, JSON.parse
in compiler
tries to parse undefined
- this is how an error Module build failed: SyntaxError: Unexpected token u
appears.
from awesome-typescript-loader.
@raveclassic thanks for your report. I'll fix this.
from awesome-typescript-loader.
@s-panferov Thanks!
Besides could you please investigate into disabling sourcemaps in general?
In my current workflow I use typescript transpiling to es6 and then pass result to babel. Somehow it appeared today that sourcemaps from typescript does not suit anymore to babel and it fails with invalid mapping
error when receiving inputSourceMap
Sure it's problem with babel or typescript, but nevertheless I failed trying to disable sourcemapping in awesome-typescript-loader.
TIA
from awesome-typescript-loader.
I have the same issue, and something more with the following configuration:
{
resolve: {extensions: ['', '.ts', '.js']},
watch: watch,
module: {
preLoaders: [{test: /\.ts$/, exclude: /node_modules/, loaders: ['tslint-loader']}],
loaders: [{test: /\.ts$/, exclude: /node_modules/, loaders: ['ng-annotate', 'awesome-typescript-loader']}]
},
output: {
filename: 'output.js'
}
}
With this configuration, the file is generated BUT there are multiple
//# sourceMappingURL=my.typescript.original.file.js.map
directives for each included transpiled module, while in the end there is a
//# sourceMappingURL=output.js.map
as it should be.
This leads to errors while processing the source maps, since all the first maps are never found (are they temporary during the transpilation process?) as only the last one is actually generated.
Then I tried to set ?sourceMap=false
to see if the issue could be fixed and I got the same error as the one reported by @nelo112.
This is similar to webpack/webpack#273 and also causes SitePen/remap-istanbul#20.
from awesome-typescript-loader.
All problems with source maps might gone in v0.15.3, please try it.
from awesome-typescript-loader.
At 0.15.3 and karma I'm still not getting sourcemaps at all with devtool: 'inline-source-map'
.
config:
{
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js']
},
output: {
devtoolModuleFilenameTemplate: "../[resource-path]",
devtoolFallbackModuleFilenameTemplate:"../[resource-path]"
},
devtool: 'inline-source-map',
module: {
loaders: [
{
test: /\.tsx?$/,
loaders: ['awesome-typescript-loader'],
},
{
test: /\.json?$/,
loaders: ['json-loader']
}
]
}
}
tsconfig:
{
"compilerOptions": {
"target": "es6",
"sourceMap": true,
"jsx": "react",
"experimentalDecorators": true,
"experimentalAsyncFunctions": true
},
"awesomeTypescriptLoaderOptions": {
"useBabel": true,
"useCache": false,
"emitRequireType": false
}
}
from awesome-typescript-loader.
@s-panferov I can confirm the fix, thanks!
from awesome-typescript-loader.
How to configure the same for react native?
from awesome-typescript-loader.
Related Issues (20)
- Module build failed: Error: Final loader
- Strange characters in logging output
- Duplicated type-checking of shared files in client and server bundles
- TypeScript 3.4 --incremental support HOT 3
- Option configFileContent cannot set target, jsx
- how to use with Metro Bundler?
- Errors not printed in CI environment
- Slowdown with [email protected] HOT 2
- error width webpack4 HOT 1
- 'Cannot find module' when compile from node_modules
- How to make the compiled decorator code not different from typescript and babel?
- Dependencies (micromatch) Security Vulnerabilities HOT 1
- Npm install breaks - JSDoc types can only be used inside documentation comments.
- TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
- incompatibility with pnpm HOT 2
- Watch for changes in *.json files
- "events" module breaks awesome-typescript-loader
- Importing TypeScript files from node_modules causes errors
- Unclear to which lines error refers HOT 1
- FYI: performance up to x4 after switching to ts-loader
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from awesome-typescript-loader.