D
D
dollaween2019-03-20 17:48:49
webpack
dollaween, 2019-03-20 17:48:49

How to connect EJS to Webpack?

I set up Webpack production mode, it works like a Swiss watch.
But I ran into one problem with development mode.
When you start development mode, it turns out that the dist folder is somewhere in the Webpack memory and in order for it to be created / updated, you need to run the build through production mode.
When I render EJS by the server, it does not see the .css, .js and other files, as they have not been created/updated yet.
At this point, I don’t understand how I can properly connect EJS to Webpack so that when I start development mode, I have access to .css, .js and other files.
My loader is like this:

{
  test: /\.ejs$/,
  loader: 'ejs-loader'
}

HtmlWebpackPlugin is configured like this:
new HtmlWebpackPlugin({
  hash: false,
  template: `${PATHS.src}/index.ejs`,
  filename: './index.ejs'
})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Ostic, 2019-03-20
@Ostic

I don’t use ejs, but in order for me to see the files in dev or prod, I don’t care, I use
those I copy the folders I need (and the files in them)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question