Angular 2网页包Systemjs.config.js脚本和css问题
我想使用webpack将angular2应用程序移至生产环境Angular 2网页包Systemjs.config.js脚本和css问题,angular,webpack,Angular,Webpack,我想使用webpack将angular2应用程序移至生产环境 <!DOCTYPE html> <html> <head> <title>iPage Quick Order</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link
<!DOCTYPE html>
<html>
<head>
<title>iPage Quick Order</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="mystyle.css">
<link rel="stylesheet" type="text/css" href="Stylesheet.css">
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="src/script/systemjs.config.js"></script>
<script src="node_modules/ng2-bs4-modal/bundles/ng2-bs4-modal.js"></script>
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script>
System.import('src/source/app/bootstrap/main').catch(function(err){ console.error(err); });
</script>
</head>
<body>
<my-app>Loading...</my-app>
</body>
</html>
iPage快速订购
System.import('src/source/app/bootstrap/main').catch(函数(err){console.error(err);});
加载。。。
我的问题是如何将css和js文件添加到web包中
因为在prod模式下,我遇到了错误,所以找不到该css和js文件。您可以使用“HtmlWebpackPlugin”,查看以下示例:
//First import this package
import HtmlWebpackPlugin from 'html-webpack-plugin';
//Then add this plugin
plugins: [
// Create HTML file that includes reference to bundled JS.
new HtmlWebpackPlugin({
template: 'src/index.html',
inject: true,
})
]
从网站:
Webpack生成许多js和css文件。我们可以手动将它们插入index.html。这将是乏味和容易出错的。Webpack可以使用HtmlWebpackPlugin为我们注入这些脚本和链接