You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Was expecting no errors and script to include the includee.
Current behaviour
ERROR in Template execution failed: ReferenceError: include is not defined
ERROR in ReferenceError: include is not defined
Environment
Tell us which operating system you are using, as well as which versions of Node.js, npm, webpack, and html-webpack-plugin. Run the following to get it quickly:
Node.js v10.15.3
System: linux 4.18.0-17-generic
NPM v6.4.1
webpack@4.32.0
html-webpack-plugin@3.2.0
Config
Copy the minimal webpack.config.js to produce this issue:
module.exports={entry: {index: './src/index/main.js',// privacy_policy: './src/privacy-policy/main.js'},output: {path: buildPath,filename: '[name].[hash:8].js'},optimization: {minimizer: [newOptimizeCSSAssetsPlugin()]},plugins: [// Cleans dist directory.newCleanWebpackPlugin(),// Perform actions as pre and post hooks.newFileManagerPlugin({onEnd: {delete: ['dist/*.js'],copy: [{source: 'src/robots.txt',destination: 'dist/'}]}}),// Index PagenewHtmlWebpackPlugin({// Don't include these assets in build artifacts.excludeAssets: [/.+\.js/],// HTML minify options:minify: {collapseWhitespace: true,removeComments: true,removeRedundantAttributes: true,removeScriptTypeAttributes: true,removeStyleLinkTypeAttributes: true,useShortDoctype: true},template: '!!ejs-loader!src/index/main.ejs',filename: 'index.html'}),newHtmlWebpackExcludeAssetsPlugin(),newMiniCssExtractPlugin({filename: 'bundle.[hash:8].css'}),// new webpack.ProvidePlugin({// _: 'underscore',// }),],module: {rules: [{test: /\.css$/,use: [MiniCssExtractPlugin.loader,'css-loader']},]}};
Copy your template file if it is part of this issue:
main.ejs:
<%- include('../components/top') %>
Relevant Links
If your project is public, link to the repo so we can investigate directly.
BONUS POINTS: Create a minimal reproduction and upload it to GitHub. This will get you the fastest support.
Additional context
I tried inlining the loader by doing: template: '!!ejs-loader!src/index/main.ejs' which failed. And also tried setting the loader in rules as below but failed as well:
{
test: /\.ejs$/,
use: 'ejs-loader',
}
The text was updated successfully, but these errors were encountered:
Expected behaviour
Was expecting no errors and script to include the includee.
Current behaviour
Environment
Tell us which operating system you are using, as well as which versions of Node.js, npm, webpack, and html-webpack-plugin. Run the following to get it quickly:
Config
Copy the minimal
webpack.config.js
to produce this issue:Copy your template file if it is part of this issue:
main.ejs:
Relevant Links
Additional context
I tried inlining the loader by doing:
template: '!!ejs-loader!src/index/main.ejs'
which failed. And also tried setting the loader inrules
as below but failed as well:The text was updated successfully, but these errors were encountered: