我正在使用带有 webpack 的谷歌地图 api,要生成谷歌地图,它应该在加载 API js 文件之前加载捆绑文件。但是 HtmlWebpackPlugin 将捆绑文件放在 body 元素的底部。如何在捆绑文件之前加载捆绑包?这是我的webpack.config.js
下面。
const webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); var path = require('path');
module.exports = {
entry: ['webpack/hot/dev-server',"./public/entry.js"],
output: {
path: path.resolve(__dirname, 'dist'),
filename: "bundle-[hash].js",
publicPath: path.resolve(__dirname, '/')
},
devServer: {
hot: true,
inline: true
},
module: {
loaders: [
{ test: /\.css$/, loader: "style-loader!css-loader" },
{ test: /\.jade$/, loader: "pug-loader"}
]
},
plugins: [
new webpack.ProvidePlugin({
'$': 'jquery',
'jQuery': 'jquery',
}),
new HtmlWebpackPlugin({
template: './views/index.jade',
})
],
devServer: {
historyApiFallback: true
} };