Which path is the path of html-webpack-plugin template relative to?

  1. A front-end vuejs project is embedded in a php project. The project directory is as follows:
.
 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

the structure of the project is like this: package.json and node_modules are placed in the root directory of the project, and the front-end vue project code is placed in the resources directory. The goal is to package the js css index.html file under the public file by running npm run build under the root directory of the project.

  1. the problem is

run npm run dev in the project"s directory always report an error, and the background changes the

in the project

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

the template of the hmtl-webpack-plugin plug-in changed from the original "index.html" to". / resources/index.html", to work properly, and now it can be developed and packaged normally, but it is not clear why it is necessary to change the file path of template, and the file path of template needs to be relative to that directory.

Mar.23,2021

the directory where the nodejs server is started

Menu