You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
Describe the bug
How do we move forward with a tsconfig.app.json file for web (angular.json) and a tsconfig.tns.json file for Nativescript?
in a @nativescript/schematics project we had a tsconfig.json and a tsconfig.tns.json file. Inside the webpack.config.js file we had several lines where they mapped the tsconfig file based on the one in the angular.json file to the tns.json file to the env.json file and it would use the most detailed one by default.
in Nativescript/Webpack 5 beta we can see it points us to use TsconfigPathsPlugin
So I still have the tsconfig json file for angular web. This includes main.ts, polyfills.ts, etc. However, when I run the app vis ns debug - it uses the tsconfig.json file from angular.json. Okay, so I figured I needed to update the new webpack.config file to tell it what one to use. I see it tells me to add 'TsconfigPathsPlugin' based on the docs. However, I added the code below to my config file and it's still using the other tsConfig.app.js file
We're moving away from code sharing with nativescript schematics and focusing on nx instead, you can read a detailed rundown of the reasons here: NativeScript/nativescript-angular#2290 (comment)
You can try to make it work, but it's not something we're officially supporting going forward. If you REALLY want to make it work you probably need to:
tap into the AngularCompilerPlugin/AngularWebpackPlugin constructor (using webpack chain) and change the tsconfig file
Environment
Provide version numbers for the following components (information can be retrieved by running
tns info
in your project folder or by inspecting thepackage.json
of the project):Describe the bug
How do we move forward with a tsconfig.app.json file for web (angular.json) and a tsconfig.tns.json file for Nativescript?
in a @nativescript/schematics project we had a tsconfig.json and a tsconfig.tns.json file. Inside the webpack.config.js file we had several lines where they mapped the tsconfig file based on the one in the angular.json file to the tns.json file to the env.json file and it would use the most detailed one by default.
in Nativescript/Webpack 5 beta we can see it points us to use TsconfigPathsPlugin
So I still have the tsconfig json file for angular web. This includes main.ts, polyfills.ts, etc. However, when I run the app vis ns debug - it uses the tsconfig.json file from angular.json. Okay, so I figured I needed to update the new webpack.config file to tell it what one to use. I see it tells me to add 'TsconfigPathsPlugin' based on the docs. However, I added the code below to my config file and it's still using the other tsConfig.app.js file
const webpack = require('@nativescript/webpack');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
module.exports = env => {
webpack.init(env)
webpack.useConfig('angular');
webpack.chainWebpack(config => {
config.resolve.plugin('TsconfigPathsPlugin').use(
new TsconfigPathsPlugin({
configFile: './tsconfig.tns.json',
logLevel: "info",
})
)
});
return webpack.resolveConfig();
}
The text was updated successfully, but these errors were encountered: