Javascript 使用Webpack和React创建一个2页的网站(index.html和another.html)
我想设置一个两页的网页(从长远来看是多页的,但本例中只有两页)。第一页看起来像这张图片,只是有一个链接,上面写着“点击我”。当你点击这个链接时,它会把你带到第二个网页,上面写着“Hello World” 我可以让一个网站的一页工作的网页。它使用这个webpack.config.js文件 webpack.config.jsJavascript 使用Webpack和React创建一个2页的网站(index.html和another.html),javascript,reactjs,webpack,babeljs,Javascript,Reactjs,Webpack,Babeljs,我想设置一个两页的网页(从长远来看是多页的,但本例中只有两页)。第一页看起来像这张图片,只是有一个链接,上面写着“点击我”。当你点击这个链接时,它会把你带到第二个网页,上面写着“Hello World” 我可以让一个网站的一页工作的网页。它使用这个webpack.config.js文件 webpack.config.js const webpack=require('webpack'); const HtmlWebpackPlugin=require('html-webpack-plugin
const webpack=require('webpack');
const HtmlWebpackPlugin=require('html-webpack-plugin');
const HtmlWebpackTemplate=require('html-webpack-template');
const path=require('path');
常量配置={
条目:{
索引:'./src/index.js'
},
输出:{
path:path.resolve(uu dirname,'./dist'),
文件名:“bundle.js”,
},
模块:{
规则:[
{
测试:/\(js|jsx)$/,
使用“babel loader”,
排除:/node_模块/,
},
],
},
决心:{
扩展:['.js','.jsx'],
}
};
module.exports=config代码>在条目中应该是这样的:
entry: {
index: './src/index.js',
services: './src/services.js'
},