将项目从SystemJS移至Angular CLI/Webpack [英] Move project from SystemJS to Angular CLI / Webpack

查看:98
本文介绍了将项目从SystemJS移至Angular CLI/Webpack的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Angular 2 + SystemJS创建的项目.不是,我想切换到Angular CLI + Webpack.有推荐的方法吗?

I have a project which I have created using Angular 2 + SystemJS. Not I want to switch to Angular CLI + Webpack. Is there are recommended way to do it ?

推荐答案

我将使用Angular CLI搭建一个空项目,然后将代码从基于SystemJS的项目移至基于Angular CLI的项目.根据项目的大小以及事物之间的相互联系,这可以是应用程序或src文件夹的简单副本,也可以是很长的时间.

I would scaffold an empty project using the Angular CLI, and then move my code over from the SystemJS based project into the Angular CLI based one. Depending on the size of the project and how interconnected things are, this could be a simple copy of the app or src folder, or could be a long affair.

总体而言,SystemJS和Angular CLI是(或多或少)构建工具,因此不应在实际的应用程序代码中进行引用,因此,最困难的部分应该是正确配置新的Angular CLI项目.这有多难,取决于您的SystemJS配置有多复杂.

Overall, SystemJS and the Angular CLI are (more or less) build tools and shouldn't be referenced in the actual application code, so the hardest part should be getting the configuration of the new Angular CLI project right. How difficult that is depends on how complicated your SystemJS configuration is.

在您的鞋子中,我将尝试首先复制整个src文件夹,看看是否一切正常,然后尝试从那里零散地移动东西.

In your shoes, I'd try copying the whole src folder first and seeing if everything runs and if not, then try moving things piecemeal from there.

需要特别注意的地方:

  • package.json -这在两个项目之间很可能会有所不同.如果可能的话,在迁移之前更新SystemJS项目以使用尽可能多的相同版本的npm软件包可能更有意义.您将不得不做出判断,要走多远

  • package.json - this is very likely to be different between the two projects. If possible, it may make more sense to update your SystemJS project to use as many of the same versions of npm packages as possible before the migration. You'll have to use judgement as to how far to go with this

tsconfig.json -同样的情况-尽管在Angular CLI端更安全地进行更改以匹配您的SystemJS配置

tsconfig.json - same story - although this can be safer to change on the Angular CLI side to match your SystemJS configuration

这篇关于将项目从SystemJS移至Angular CLI/Webpack的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆