A webpack loader for compiling ejs style files at build time.
npm install ejs-transform-loader
// webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.ejs$/,
loader: `ejs-transform-loader`,
options: {
data: { testFiles: process.env.TEST_FILES }
}
},
],
},
}
// some-file.ejs
const testFiles = [ <%= testFiles %> ];