How link WebMap package to the migrated Application
Sometimes when we want to debug a frontend package in the migrated application the process of generating a package, and installing it, and then using it can be a bit slow.
npm has a feature called link, which allows us to link the node_module of a package to an address on the PC's storage. For example, if we have a migrated application and we want to make some changes in the @mobilize/winforms-components repository, you do the yarn install or the npm install that you normally do, but how can you make changes to that package and test them in the migrated application?
Let's assume that you have a migrated project, to which you want to connect the @mobilize/winforms-components repository to test some changes.
Go to the repository path, in my case is D:\Repositories\WFNetKendoComponents\WinformsComponentopen a cmd and compile the application
npm run build
Go with the terminal to the dist folder after compiling the repository, in my case is D:\Repositories\WFNetKendoComponents\WinformsComponent\dist and execute the link command.
> cd dist
> npm link
You should see something like that:
repository: link command
Add a new property preserveSymlinks in the angular.json of the migrated project.
// Add this new line
Open a cmd in the root of the migrated application and execute the next npm link with the package_name:
npm link @mobilize/winforms-components
you should see something like:
link: migrated path
If you check your node_modules you should see a shortcut in your package folder
winforms package as npm link
After link the package, you must compile your application as usual, for example
npm run debug
Suppose you already did the linking process and you made a change to the @mobilize/winforms-components repository that you want to test in your migrated application.
- 1.Stop the ng serve process if you are using it in the migrated application.
- 2.Compile the repository with the change made.
- 3.Compile the migrated application or start the ng serve process.
You can use one or more linked repositories in a migrated application.
you can execute the unlink command to delete the link folder.