简体   繁体   English

从AngularJS dist文件夹创建符号链接到另一个Angular.io dist文件夹

[英]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: 在生产中,其工作方式如下:

  • appio is built with ng build. appio是使用ng build构建的。
  • appjs is built with npm run build. appjs是使用npm run build构建的。
  • appjs is served with Apache, but appio is served through a symlink that is included in appjs/dist. appjs与Apache一起提供,但appio通过appjs / dist中包含的符号链接提供。 This symlink is automatically created on production. 此符号链接在生产时自动创建。

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.

相关问题 Yeoman Gruntfile dist任务不复制.tmp文件夹中的样式(AngularJs) - Yeoman Gruntfile dist task Not copying styles from .tmp folder (AngularJs) Webpack / Angular不将引导程序发送到dist文件夹 - Webpack / Angular not sending bootstrap to dist folder htaccess重写到dist文件夹并将AngularJS html5mode设置为true - htaccess rewrite to dist folder and set AngularJS html5mode true 在使用Firebase引导我的angular 2打字稿应用程序时遇到麻烦,无法创建用于部署到实时环境的dist文件夹 - Having trouble bootstrapping my angular 2 typescript app with Firebase in order to create a dist folder for deploying to live environment Yeoman / Grunt / Angular中的dist build目标文件夹是什么? - What is a dist build target folder in Yeoman / Grunt / Angular? Yeoman angular dist版本的应用程序,不限制直接文件夹访问 - Yeoman angular dist version of app, does not restrict the direct folder access Grunt Dist文件夹相对路径错误 - Grunt Dist Folder Relative Path Errors angular gulp-如何根据每个src文件夹拆分dist文件夹中的js文件 - angular gulp - how to split js file in dist folder according to each src folder 使用grunt构建生成的dist文件夹不起作用 - dist folder generated using grunt build not working 在仓库上存储“ dist”文件夹以进行部署的最佳实践 - Best practices to store “dist” folder on repo for deploy
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM