[英]Create symlink from AngularJS dist folder to a different Angular.io dist folder
I'm working on a project that is made of an AngularJS app (I'll call it appjs ) and an Angular.io (v6) app (that I'll call appio ). 我正在开发一个由AngularJS应用程序(我称为appjs )和Angular.io (v6)应用程序(我称为appio )组成的项目。 On production, it works as follows:
在生产中,其工作方式如下:
So, imagine that appio controls the /login. 因此,想象一下appio控制/ login。 When someone wants to login in the app, it will be redirected to something like:
当某人想要登录该应用程序时,它将被重定向到以下内容:
test.com/appjs/appio/login (where appio is the symlink I was talking about.)
test.com/appjs/appio/login(其中appio是我正在谈论的符号链接。)
This works... for now, on production, but on development every time the project is built, I have to create the symlink manually, as every time a change in appjs is done, appjs's dist folder is entirely rebuilt and the symlink is lost. 现在就可以使用,在生产中,但是在开发中,每次构建项目时,我都必须手动创建symlink,因为每次更改appjs时,都会完全重建appjs的dist文件夹,并且符号链接会丢失。
I have tried Webpack Shell Plugin to automate the symlink creation with something like 我已经尝试过使用Webpack Shell Plugin来自动创建符号链接,例如
ln -s ~/appio/dist/appio/ ~/appjs/dist/appio
ln -s〜/ appio / dist / appio /〜/ appjs / dist / appio
but it's onBuildEnd event happens before dist folder is created. 但是它的onBuildEnd事件发生在创建dist文件夹之前。
Does someone knows how could I automatically inject this symlink into the appjs's dist folder? 有人知道我怎么能自动将这个符号链接注入到appjs的dist文件夹中?
I would like to clarify I did not create this project's architecture. 我想澄清一下,我没有创建该项目的体系结构。
Thanks a lot. 非常感谢。
I just solved the problem. 我刚刚解决了这个问题。 1. Create the symlink in the src folder (or wherever your code is) 2. Add cleanup plug in to your webpack config 3. Inside the plugin config, exclude the symlink file After every compilation, webpack will just copy the symlink to the dist folder.
1.在src文件夹(或代码所在的位置)中创建符号链接2.将清理插件添加到您的webpack配置中3.在插件配置内部,排除符号链接文件每次编译后,Webpack只会将符号链接复制到dist夹。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.