Error:
EXCEPTION: Error in :0:0 caused by: The selector "ng-component" did not match any elements
The application works fine when working with systemjs directly. When I tried to build globals.bundle.js and app.bundle.js using webpack and deploy, I get this error.
All files and dependencies load in order.
Here is my HTML
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <!DOCTYPE html> <html lang="en"> <head> <title>Maven + Spring MVC</title> <base href="/survey-web/"> <spring:url value="/resources/core/css/hello.css" var="coreCss" /> <spring:url value="/resources/core/css/bootstrap.min.css" var="bootstrapCss" /> <link href="${bootstrapCss}" rel="stylesheet" /> <link href="${coreCss}" rel="stylesheet" /> <%--<script src="resources/node_modules/zone.js/dist/zone.min.js"></script> <script src="resources/node_modules/reflect-metadata/Reflect.js"></script> <script src="resources/js/system.src.js"></script> <script src="resources/systemjs.config.js"></script>--%> <script src="resources/dist/globals.bundle.js"></script> <script src="resources/dist/app.bundle.js"></script> <script>
Webpack configuration
module.exports = { entry: { globals: [ 'zone.js', 'reflect-metadata' ], app: './app/main.ts', }, module: { loaders: [ {test: /.ts$/, loader: 'awesome-typescript-loader'}, ] }, output: { filename: '[name].bundle.js', path: './dist' } };
Plunkr
https://plnkr.co/edit/AfYGsdHpIVnVnuF7BCUJ?p=preview Although this only happens in the webpack assembly in my local environment, I can reproduce this via plnkr
source share