webpack 4 support #534
Comments
Please update enhanced-resolve dependency binding |
Any news? |
I hope to find some time next weekend. |
Hey, maybe you need some help? I've started building an updated configuration for all of our projects with webpack 4 and I've encountered some errors right away with As I'm more than familiar with working on build tools and with typescript's compiler API, I think I could help 🙂 |
@DovydasNavickas I would glad if you make some investigation about what we need to do to properly migrate. I know that |
Snap... |
I guess a good starting point is this article: |
Ok, so it's an easy fix for a changed Webpack's API instead of So, to not get Webpack's errors we have to update function function setupWatchRun(compiler, instanceName: string) {
- compiler.plugin('watch-run', function(watching, callback) {
- const instance = resolveInstance(watching.compiler, instanceName)
+ compiler.hooks.watchRun.tapAsync(PACKAGE_NAME, (compiler, callback) => {
+ const instance = resolveInstance(compiler, instanceName)
const checker = instance.checker
const watcher =
- watching.compiler.watchFileSystem.watcher ||
- watching.compiler.watchFileSystem.wfs.watcher
+ compiler.watchFileSystem.watcher ||
+ compiler.watchFileSystem.wfs.watcher
- const startTime = instance.startTime || watching.startTime
+ const startTime = instance.startTime But then it starts spitting out errors (58 errors in my case, to be exact) in Typescript's typechecking, such as:
Soo.... It clearly has some problems with compiler configuration before it starts compiling after watch change and I'm not really sure where to start looking. Maybe you could take a look? By the way, exactly same kind of upgrade has to be done for In short, I'll have to spend a bit more time to get a good sense about how the library works, because I did not manage to come up with a proper debugging strategy apart from |
P.S. now that I think of it, why the hell didn't I go with using tests right away?... I guess sometimes you just don't think on Sundays 😂 |
So I noticed that I get the following error when the following web pack plugin is enabled
|
Has anyone found a work around for this? I'm also hitting the issue with #541 on incremental rebuilds |
Same problem for me with Webpack 4.0.1 and the latest version of the plugin. |
Problems with v4.0.0-0
However works with
|
Getting the same error as @kevupton. Versions:
|
I'm getting the same error (
Is there any fix for this yet? I might have to look into migrating to ts-loader if it works there. I hope migrating isn't too much trouble. Edit: I tried installing awesome-typescript-loader@next but it just fails to install with various errors. ts-loader it is then... |
@ChrisTucker2000 Installing @next worked for me. The biggest issue now is that incremental builds don't work. I have to manually rebuild which kills productivity. |
Same |
I tested the version 4.0.0-1 and the loading of the libraries dom and es2015 does not work anymore. |
I have the same problem. I tried to use ts-loader like @s-panferov and @ChrisTucker2000 suggested. It was easy to configure and it automatically rebuilds just fine, it is however incredibly slow for me (~3 Min. vs 20 Sec. of a-t-l). |
Here's a patch which you can apply with patch-package. It should do the job for version 3.5.0. File should be named
|
@vladimiry The plugin has an issue though. If your tsconfig.json extends another tsconfig.json, it throws an error indicating baseUrl not found :( "tsconfig-paths-webpack-plugin: Found no baseUrl in tsconfig.json, not applying tsconfig-paths-webpack-plugin" |
@giridhara-avadhani in general putting |
@s-panferov is there a reason why typescript 2.7 is required in 5.0.0-1? Currently stable Angular 5.x requires 2.6. Any ideas when 5.0.0-1 will be official ? |
@drrudkh it worked for me too |
5.0.0-1 fixed it for me, although still working on a pcss caching issue I don't think is related. Caching issue is chrome only |
upgrading to |
|
@djpeach it worked, thanks |
Guys, what are the changes to apply in the webpack.config.ts file to use awesome-typescript-loader 5 ? |
@omatrot I didn't have to change anything in my webpack.config files to make it work. I just had to download it using Yarn/NPM. |
When's v5 going to become official? Seems to work and everyone is here looking for it anyway |
I tested with v5.0.0-1, but encountered this error: Error: Cannot find module './dist' |
Also I get this error. Configured "paths" like:
And then got error:
|
Upgrading TypeScript from 2.5.3 to 2.8.3 fixed the following error for me
same as what @kevupton reported. |
Thanks to @djpeach's comment, its working for me after updating typescript to 2.8.3 . it is however incredibly slow :( |
@eddy14u webpack 4 defaults do production mode, which is very slow, since it does a lot. Have you tried development mode? |
For anyone wondering, I got it working with const { CheckerPlugin } = require('awesome-typescript-loader')
const TsConfigPathsPlugin = require('tsconfig-paths-webpack-plugin')
module.export = {
resolve: {
extensions: ['.ts', '.tsx'],
plugins: [
new TsConfigPathsPlugin({
configFile: './tsconfig.json',
}),
],
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
use: [
{
loader: 'awesome-typescript-loader',
options: {
silent: true,
useBabel: true,
babelOptions: {
compact: process.env.NODE_ENV === 'production',
highlightCode: true,
},
babelCore: '@babel/core',
useCache: true,
},
},
],
},
],
},
plugins: [new CheckerPlugin()],
} |
Just did some upgrades myself, and have working builds with reload using
|
Switching to ts-loader worked for us. |
@dlabrecq My end goal was Angular v5 AoT build (SASS / TypeScript) with Karma + Jasmine and webpack v4, and found that ts-loader was playing nicer with that stack for our needs after further testing (performance and general interop with other tools we are using.) I think in my previous comment, I hadn't implemented AoT yet and hadn't started benchmarking certain KPIs on our end, but technically it seems that they do work together, though YMMV. |
@marcofugaro could you please share your package.json to check versions of dependencies as well as tsconfig.json |
Hello! I'm having the same error @kevupton had too: This happens when I specify the How can I resolve this? Is this still an open issue? I've tried adding the TypeScript: 3.5.1 tsconfig.json (.storybook folder):
tsconfig.json (root folder):
Result:
Thanks! P.S. |
Webpack 4 in beta now, so can you update plugin to support it?
The text was updated successfully, but these errors were encountered: