Html-webpack-plugin: Do not evaluate certain expressions

Created on 22 Oct 2016  路  3Comments  路  Source: jantimon/html-webpack-plugin

Is it possible to skip evaluation of certain expressions in template? I have .html.ftl templates which have some expressions which are supposed to be handled by server. I don't want html-webpack-plugin to do anything with them, but they are causing bundling errors.

Just quick example:

<script src="${keycloak.serverUrl}/js/keycloak.js"></script>

expression ${keycloak.serverUrl} is supposed to be handled by server and I would like webpack to ignore it.

ERROR in Template execution failed: ReferenceError: keycloak is not defined

ERROR in ReferenceError: keycloak is not defined

  • index.html.ftl:17115
    /home/dklingen/projects/klinki-windup-web/ui/src/main/webapp/src/index.html. ftl:17115:10
  • index.html.ftl:17118 module.exports
    /home/dklingen/projects/klinki-windup-web/ui/src/main/webapp/src/index.html. ftl:17118:3
  • index.js:255
    [webapp]/[html-webpack-plugin]/index.js:255:16
  • util.js:16 tryCatcher
    [webapp]/[html-webpack-plugin]/[bluebird]/js/release/util.js:16:23
  • promise.js:510 Promise._settlePromiseFromHandler
    [webapp]/[html-webpack-plugin]/[bluebird]/js/release/promise.js:510:31
  • promise.js:567 Promise._settlePromise
    [webapp]/[html-webpack-plugin]/[bluebird]/js/release/promise.js:567:18
  • promise.js:604 Promise._settlePromiseCtx
    [webapp]/[html-webpack-plugin]/[bluebird]/js/release/promise.js:604:10
  • async.js:143 Async._drainQueue
    [webapp]/[html-webpack-plugin]/[bluebird]/js/release/async.js:143:12
  • async.js:148 Async._drainQueues
    [webapp]/[html-webpack-plugin]/[bluebird]/js/release/async.js:148:10
  • async.js:17 Immediate.Async.drainQueues [as _onImmediate]
    [webapp]/[html-webpack-plugin]/[bluebird]/js/release/async.js:17:14

Child html-webpack-plugin for "index.html.ftl"

Most helpful comment

Sure :) the webpack html plugin is using this loader only if you don't specify another loader.

So you could use the text loader:

template: 'text!index.html'

All 3 comments

Sure :) the webpack html plugin is using this loader only if you don't specify another loader.

So you could use the text loader:

template: 'text!index.html'

Thanks, it works :) 馃憤

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings