If you specify any *.js file as an entry point inside the webpack configuration, ts-loader will throw an error (Module build failed: Error: Could not find file: ...).
...
entry: [
'./src/app.js'
],
...
I think this is ts-loader issue because TypeScript 1.8.0 and greater can transpile JavaScript files and import them. You have to set allowJs property to true to get this functionality working. Simply run the following code to test this.
tsc ./src/app.js --allowJs --outDir tsDist
For ts-loader, it seems that just an entry point must be always a *.ts file. Inside the entry module you actually are allowed to import and use both es6 and ts files.
Yup I have the same problem :(
Will try to address this in the next release.
Btw, the js files included via ///<reference> seems also to be skipped by ts-loader.
What is the timeline for the next release?
Any news on this?
Wondering if there are any updates or if anyone has found a workaround for this in the interim?
@dwasyluk I believe this should've been fixed in 0.9.3. Can you please try that version?
Yes this should be fine now I hope. Closing for now.
I can't get it to work.
My tsconfig.json looks like this:
{
"compileOnSave": true,
"compilerOptions": {
"declaration": false,
"diagnostics": true,
"allowJs": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "system",
"moduleResolution": "classic",
"noImplicitAny": true,
"preserveConstEnums": true,
"pretty": true,
"removeComments": false,
"rootDir": ".",
"sourceMap": true,
"sourceRoot": "/static/",
"target": "es6",
"outFile": "script_folder_one/scriptfilebundle.js"
},
"files": [
"script_folder_one/nontypescript.js",
"script_folder_one/scriptfile_01.ts",
"script_folder_one/scriptfile_02.ts",
"script_folder_two/eventmanager.ts"
]
}
You need to set the entryFilesIsJs loader option - see the docs
We are using these compiler options: https://www.typescriptlang.org/docs/handbook/compiler-options.html
What you are describing isn't there. I'm using Visual Studio 2015 and it wont include the js files with the ts. But if I compile it with gulp-typescript, it works.
I see now that this thread is about ts-loader... I'm moving on.
What you are describing isn't there
Make sure you are using 1.3.0
I see now that this thread is about ts-loader... I'm moving on.
Right... This is webpack - if that's not what you're after we can't help
@johnnyreilly since the ts section is, as you note in #425, disallowed by Webpack 2, is there currently a way to set this up? I am trying to convert a Webpack 1.14 application and would rather not switch to _awesome-typescript-loader_.
@johnnyreilly sorry, I just re-read the issue, 'ts-loader?allowJsEntry=true' does the trick. (face-palm).
No worries!
Most helpful comment
Any news on this?