html-webpack-plugin template的路径是相对于那个路径的?

  1. 一个php项目中嵌入一个前端的vuejs项目,项目的目录如下:
.
├── app
├── debug.log
├── node_modules
├── nodemon.json
├── package.json
├── phpunit.xml
├── public
│   ├── index.html
│   ├── index.php
│   ├── mix-manifest.json
│   ├── robots.txt
│   └── static
├── readme.md
├── resources
│   ├── README.md
│   ├── build
│   ├── config
│   ├── index.html
│   ├── src
│   └── static
├── routes
│   ├── api.php
│   ├── channels.php
│   ├── console.php
│   └── web.php
├── server.php
└── yarn.lock

项目的结构是这样的,package.json和node_modules 都是放在了项目的根目录下,resources目录下放着前端的vue项目代码。目的是实现在项目根目录下运行npm run build 将js css index.html 文件 打包到public 文件下。

  1. 问题是:

在项目的跟目录下运行npm run dev总是报错,后台把webpack.dev.conf.js 中的

new HtmlWebpackPlugin({
      filename: 'index.html',
      template: './resources/index.html',
      inject: true
    }),

hmtl-webpack-plugin插件的template由原来的‘index.html’改为'./resources/index.html',才工作正常,现在是可以正常的开发和打包了,但是不清楚为什么需要时改template 的文件路径,template的文件路径需要相对于那个目录?

阅读 3.4k
1 个回答

启动nodejs服务器的目录

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题