Angular X AOT + Rollup的那些坑

Pitfalls

reflect-metadata shim is required when using class decorators

Solution from Stackoverflow:
These two are needed to be imported on the typescript file, they are required since we are using the ng directives.
I think you are missing only the following, which needs to be at the beginning of your top level typescript or JavaScript file. Specifically, these need to be prior to the first line is that loads Angular.

import 'zone.js';
import 'reflect-metadata';

把上述代码加到 main-aot.ts, 虽然解决了angular X loading的问题,但会出现如下错误:

Uncaught ReferenceError: require is not defined
build.js:1
build.js:1

这是因为rollup没法处理这种import, 改用

你可能感兴趣的:(Angular X AOT + Rollup的那些坑)