-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
I'm having a bit of trouble deploying my webpack 2 app to Heroku. It seems like my app, using Underscore Templates in with my HTML is having trouble.
When I deploy to Heroku I get: ERROR in Template execution failed: ReferenceError: __webpack_require__ is not defined
My Repo is here: https://github.com/CheezItMan/tasklist-js
My webpack.config.js is:
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var webpack = require('webpack');
var HTMLWebpackPlugin = require('html-webpack-plugin');
const DEVELOPMENT = process.env.NODE_ENV === 'development';
const PRODUCTION = process.env.NODE_ENV === 'production';
var entry = PRODUCTION ? './src/app.js' :
['./src/app.js',
'webpack/hot/dev-server',
'webpack-dev-server/client?http://localhost:8080'
];
var plugins = PRODUCTION ? [
new webpack.LoaderOptionsPlugin({ minimize: false, debug: false }),
new ExtractTextPlugin('style-[contenthash:10].css'),
new HTMLWebpackPlugin({
template: 'index.html'
})
]
: [
new webpack.HotModuleReplacementPlugin(),
new ExtractTextPlugin('styles.scss')
];
plugins.push(
new webpack.DefinePlugin({
DEVELOPMENT: JSON.stringify(DEVELOPMENT),
PRODUCTION: JSON.stringify(PRODUCTION)
})
);
plugins.push (
new webpack.ProvidePlugin({
"$": 'jquery',
"jQuery": 'jquery',
'window.jQuery': 'jquery'
})
);
const cssIdentifier = PRODUCTION ? '[hash:base64:10]' : '[path][name]---[local]';
const cssLoader = PRODUCTION ? ExtractTextPlugin.extract({
loader: 'css-loader?minimize&localIdentName=' + cssIdentifier
})
: ['style-loader', 'css-loader?localIdentName=' + cssIdentifier];
module.exports = {
devtool: 'source-map',
entry: entry,
plugins: plugins,
output: {
path: path.join(__dirname, 'dist'),
publicPath: PRODUCTION ? '/' : '/dist/',
filename: PRODUCTION ? 'bundle.[hash:12].min.js' : 'bundle.js'
},
module: {
loaders: [{
test: /\.js$/,
loaders: ['babel-loader'],
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif)$/,
loaders: ['url-loader?limit=10000&name=images/[hash:12].[ext]'],
exclude: '/node_modules/'
},
{
test: /\.(css|scss)$/,
loaders: cssLoader,
exclude: /node_modules/
},
{
test: /\.html$/,
loader: "underscore-template-loader",
exclude: /node_modules/,
query: {
engine: 'lodash',
}
}
]}
};
Metadata
Metadata
Assignees
Labels
No labels