Reputation: 1773
I want to load a custom template for the plugin 'html-webpack-plugin'.
I have this index.ejs and this webpack.config.js
But I have this error when build:
ERROR in Error: Child compilation failed: Module build failed: SyntaxError: /Users/saro/Projects/react-starter/app/assets/index.ejs: Unexpected token (1:1)
1 | <!DOCTYPE html>
Upvotes: 2
Views: 9068
Reputation: 7912
first, install the loader:
npm install ejs-loader --save-dev
then update your webpack.config.js (add ejs!
):
plugins: [
new HtmlwebpackPlugin({
title: 'React Starter Kit',
hash: true,
inject: false,
appMountId: 'app',
template: 'ejs!app/assets/index.ejs'
})
]
Upvotes: 2