We have a file requiring a jade template rendered on server side during runtime.
define(['underscore', 'html!/templates/myTemplate'], function (_, template){
...
})
The idea is to bundle the other dependencies (here underscore) on compile but require the template only on runtime.
We tried using externals like this but it didn't change anything.
externals: {
'/templates/myTemplate': '/templates/myTemplate'
}
But the same error is displayed when we compile the bundle:
Module not found: Error: Cannot resolve 'file' or 'directory' /templates/myTemplate ...
Any idea?
Here is our settings file
module.exports = {
context: __dirname,
entry: {
"pageA": "./pageA.js",
"pageB": "./pageB.js"
},
output: {
"path": __dirname + '/dist',
"publicPath": './javascripts/dist/',
"filename": '[name].js'
},
plugins: [
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
})
]
};
This is not possible using Webpack only: https://github.com/webpack/webpack/issues/2326