Reputation: 773
I have the webpack.config.js like the following
var path = require('path')
var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var PORT = process.env.PORT || 3333
var PRODUCTION = process.env.NODE_ENV === 'production'
var SRC_DIR = path.resolve(__dirname, './src')
var Webpack_isomorphic_tools_plugin = require('webpack-isomorphic-tools/plugin')
var config = {
entry: [
'./src/index'
],
output: {
path: path.join(__dirname, '/'),
filename: 'bundle.js',
publicPath: '/'
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new HtmlWebpackPlugin({ template: './index.html' })
],
resolve: {
extensions: ['', '.js', '.jsx']
},
module: {
loaders: [
{
test: /\.jsx?$/,
loaders: ['react-hot', 'babel'],
include: SRC_DIR
},{ test: /\.css$/, loader: "style-loader!css-loader" }
]
}
}
if (!PRODUCTION) {
config.devtool = 'eval'
}
module.exports = config
Whenever I run a prod build using
webpack -p
it inserts a script tag
<script type="text/javascript" src="/bundle.js"></script>
into my index.html I could not figure out which part of the webpack.config.js is doing this... How can I stop this?
thanks
mark
Upvotes: 2
Views: 3008
Reputation: 2403
The plugin in charge of doing that is HTMLWebpackPlugin
which if you pass the option inject
as false
, then it will stop injecting your assets to the HTML.
Here you have the full doc https://github.com/jantimon/html-webpack-plugin
Hope it helps.
Upvotes: 4
Reputation: 6814
Old
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new HtmlWebpackPlugin({ template: './index.html' })
]
New
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
]
Then you have to reference those bundles that webpack generates yourself inside your index.html file
Upvotes: 0