直接上代码:
webpack.config.js
import webpack from "webpack";
import path from "path";
var path = path.resolve(__dirname,"/main.j")
var ExtractTextPlugin = require("extract-text-webpack-plugin");//css,js分离插件,
//使用该插件需要独立下载'npm install extract-text-webpack-plugin --save-dev', 同时下面的rules也必须更改
var CleanWebpackPlugin = require("clean-webpack-plugin");//要清除重复打包的文件重复问题
// 需要先进行安装 npm install --save-dev html-webpack-plugin inline-menifest-webpack-plugin
var HtmlWebpackPlugin = require("html-webpack-plugin");//动态将打包好的js css文件注入到index.html
var InlineMenifestWebpackPlugin = require("inline-menifest-webpack-plugin");//动态将打包好的js css文件注入到index.html
var isProduction = process.env.NODE_ENV === 'production';
var filename = isProduction ? '[name].[chunkhash].js':'[name].js';
module.exports={
entry: {
main: ".src/main.j",
// ventor: ['jquery']
},
output:{
path: path.resolve(__dirname, './build'),
filename: filename//根据模块内容计算哈希值
},
module : {
// npm install babel-loader babel babel-core css-loader sass-loader style-loader url-loader file-loader less-loader less --save-dev
rules: [
// npm install --save-dev babel-preset-es2015
// npm install --save-dev babel-preset-react
// npm install babel-loader --save-dev
// npm install babel-core --save-dev
// npm install babel-preset-es2015 --save
// npm install --save-dev babel-preset-react
// npm install --save-dev jsx-loader
{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
exclude: /node_modules/, //不进行转换的文件,可以提高打包速度
},
{
test:/\.sass$/,
use:ExtractTextPlugin.extract({
use:[{
loader:'css-loader',
options:{
minimize: isProduction
}
},
'sass-loader'
],
fallback:'style-loader'
})
},
{test: /\.css$/, use: ['style-loader', 'css-loader']},/*解析css, 并把css添加到html的style标签里*/
{test: /\.less$/, use: ['style-loader', 'css-loader', 'less-loader']},/*解析less, 把less解析成浏览器可以识别的css语言*/
{
test: /\.(jpe?g|png|gif|svg)$/,
use: {
limit:8192,
name:'[name].[hashs].[ext]',
outputPath: 'images/'
}
},/*解析图片*/
{test: /\.(woff|woff2|eot|ttf|otf)$/,use: ['file-loader']}//解析文字
]
},
resolve: {
extensions: ['jsx', '.js', '.json', '.css','.scss']
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.BannerPlugin('翻版必究'),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
// new webpack.optimize.CommonsChunkPlugin('node_modules'),//把公共模块提取出来, 并取名为'common'(名字自起), webpack之后再out文件夹下生成common.js, 测试时记得引入提取出来的公共模块js文件,
new ExtractTextPlugin('[name].css'),
new webpack.ProvidePlugin({$: 'jquery', jQuery: 'jquery', 'window.jQuery': 'jquery'}),//引入jquery
// 要清除重复打包的文件重复问题
new CleanWebpackPlugin(['build'],{
root: _dirname,
verbose: true,
dry: false
}),
new HtmlWebpackPlugin({
template: 'webpackManifest'
}),
new InlineManifestWebpackPlugin({
name: 'webpackManifest'
})
]
};
if(isProduction){//只有在生产环境下,才需要进行压缩
module.exports.plugins.push(
new webpack.optimize.UglifyJsPlugin({minimize: true}),//js代码压缩,
)
}
package.json:
{
"devDependencies": {
"babel": "^6.23.0",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"css-loader": "^1.0.0",
"file-loader": "^1.1.11",
"less": "^3.8.1",
"less-loader": "^4.1.0",
"style-loader": "^0.22.1",
"url-loader": "^1.0.1",
"webpack": "^4.16.5",
"webpack-cli": "^3.1.0"
},
"name": "wp-demo",
"version": "1.0.0",
"private": true,
"dependencies": {
"[email protected]@acorn-dynamic-import": "^3.0.0",
"[email protected]@acorn": "^5.7.1",
"[email protected]@ajv-keywords": "^3.2.0",
"[email protected]@ajv": "^6.5.2",
"[email protected]@anymatch": "^2.0.0",
"[email protected]@aproba": "^1.2.0",
"[email protected]@arr-flatten": "^1.1.0",
"[email protected]@arr-diff": "^4.0.0",
"[email protected]@arr-union": "^3.1.0",
"[email protected]@array-unique": "^0.3.2",
"[email protected]@assert": "^1.4.1",
"[email protected]@asn1.js": "^4.10.1",
"[email protected]@assign-symbols": "^1.0.0",
"[email protected]@async-each": "^1.0.1",
"[email protected]@atob": "^2.1.1",
"[email protected]@balanced-match": "^1.0.0",
"[email protected]@base": "^0.11.2",
"[email protected]@base64-js": "^1.3.0",
"[email protected]@big.js": "^3.2.0",
"[email protected]@binary-extensions": "^1.11.0",
"[email protected]@bluebird": "^3.5.1",
"[email protected]@bn.js": "^4.11.8",
"[email protected]@brace-expansion": "^1.1.11",
"[email protected]@braces": "^2.3.2",
"[email protected]@brorand": "^1.1.0",
"[email protected]@browserify-cipher": "^1.0.1",
"[email protected]@browserify-des": "^1.0.2",
"[email protected]@browserify-rsa": "^4.0.1",
"[email protected]@browserify-sign": "^4.0.4",
"[email protected]@browserify-aes": "^1.2.0",
"[email protected]@browserify-zlib": "^0.2.0",
"[email protected]@buffer-from": "^1.1.1",
"[email protected]@buffer-xor": "^1.0.3",
"[email protected]@builtin-status-codes": "^3.0.0",
"[email protected]@cacache": "^10.0.4",
"[email protected]@cache-base": "^1.0.1",
"[email protected]@chokidar": "^2.0.4",
"[email protected]@buffer": "^4.9.1",
"[email protected]@chownr": "^1.0.1",
"[email protected]@chrome-trace-event": "^1.0.0",
"[email protected]@cipher-base": "^1.0.4",
"[email protected]@collection-visit": "^1.0.0",
"[email protected]@commander": "^2.13.0",
"[email protected]@commondir": "^1.0.1",
"[email protected]@component-emitter": "^1.2.1",
"[email protected]@concat-map": "^0.0.1",
"[email protected]@class-utils": "^0.3.6",
"[email protected]@concat-stream": "^1.6.2",
"[email protected]@console-browserify": "^1.1.0",
"[email protected]@constants-browserify": "^1.0.0",
"[email protected]@copy-concurrently": "^1.0.5",
"[email protected]@copy-descriptor": "^0.1.1",
"[email protected]@core-util-is": "^1.0.2",
"[email protected]@create-ecdh": "^4.0.3",
"[email protected]@create-hash": "^1.2.0",
"[email protected]@create-hmac": "^1.1.7",
"[email protected]@cyclist": "^0.2.2",
"[email protected]@crypto-browserify": "^3.12.0",
"[email protected]@date-now": "^0.1.4",
"[email protected]@debug": "^2.6.9",
"[email protected]@debug": "^3.1.0",
"[email protected]@decode-uri-component": "^0.2.0",
"[email protected]@define-property": "^0.2.5",
"[email protected]@define-property": "^1.0.0",
"[email protected]@define-property": "^2.0.2",
"[email protected]@des.js": "^1.0.0",
"[email protected]@domain-browser": "^1.2.0",
"[email protected]@diffie-hellman": "^5.0.3",
"[email protected]@duplexify": "^3.6.0",
"[email protected]@elliptic": "^6.4.1",
"[email protected]@emojis-list": "^2.1.0",
"[email protected]@end-of-stream": "^1.4.1",
"[email protected]@enhanced-resolve": "^4.1.0",
"[email protected]@errno": "^0.1.7",
"[email protected]@eslint-scope": "^4.0.0",
"[email protected]@esrecurse": "^4.2.1",
"[email protected]@estraverse": "^4.2.0",
"[email protected]@events": "^1.1.1",
"[email protected]@evp_bytestokey": "^1.0.3",
"[email protected]@expand-brackets": "^2.1.4",
"[email protected]@extend-shallow": "^3.0.2",
"[email protected]@extglob": "^2.0.4",
"[email protected]@fast-deep-equal": "^2.0.1",
"[email protected]@fast-json-stable-stringify": "^2.0.0",
"[email protected]@extend-shallow": "^2.0.1",
"[email protected]@fill-range": "^4.0.0",
"[email protected]@find-cache-dir": "^1.0.0",
"[email protected]@find-up": "^2.1.0",
"[email protected]@flush-write-stream": "^1.0.3",
"[email protected]@for-in": "^1.0.2",
"[email protected]@fragment-cache": "^0.2.1",
"[email protected]@from2": "^2.3.0",
"[email protected]@fs-write-stream-atomic": "^1.0.10",
"[email protected]@fs.realpath": "^1.0.0",
"[email protected]@fsevents": "^1.2.4",
"[email protected]@get-value": "^2.0.6",
"[email protected]@graceful-fs": "^4.1.11",
"[email protected]@glob": "^7.1.2",
"[email protected]@has-value": "^0.3.1",
"[email protected]@glob-parent": "^3.1.0",
"[email protected]@has-value": "^1.0.0",
"[email protected]@has-values": "^0.1.4",
"[email protected]@has-values": "^1.0.0",
"[email protected]@hash-base": "^3.0.4",
"[email protected]@hash.js": "^1.1.5",
"[email protected]@hmac-drbg": "^1.0.1",
"[email protected]@https-browserify": "^1.0.0",
"[email protected]@ieee754": "^1.1.12",
"[email protected]@iferr": "^0.1.5",
"[email protected]@imurmurhash": "^0.1.4",
"[email protected]@indexof": "^0.0.1",
"[email protected]@inflight": "^1.0.6",
"[email protected]@inherits": "^2.0.1",
"[email protected]@inherits": "^2.0.3",
"[email protected]@is-accessor-descriptor": "^0.1.6",
"[email protected]@is-accessor-descriptor": "^1.0.0",
"[email protected]@is-binary-path": "^1.0.1",
"[email protected]@is-buffer": "^1.1.6",
"[email protected]@is-data-descriptor": "^0.1.4",
"[email protected]@is-data-descriptor": "^1.0.0",
"[email protected]@is-descriptor": "^0.1.6",
"[email protected]@is-extendable": "^0.1.1",
"[email protected]@is-extendable": "^1.0.1",
"[email protected]@is-extglob": "^2.1.1",
"[email protected]@is-glob": "^3.1.0",
"[email protected]@is-glob": "^4.0.0",
"[email protected]@is-number": "^3.0.0",
"[email protected]@is-plain-object": "^2.0.4",
"[email protected]@is-windows": "^1.0.2",
"[email protected]@isobject": "^2.1.0",
"[email protected]@isarray": "^1.0.0",
"[email protected]@isobject": "^3.0.1",
"[email protected]@is-descriptor": "^1.0.2",
"[email protected]@json-parse-better-errors": "^1.0.2",
"[email protected]@json-schema-traverse": "^0.4.1",
"[email protected]@json5": "^0.5.1",
"[email protected]@kind-of": "^4.0.0",
"[email protected]@kind-of": "^3.2.2",
"[email protected]@kind-of": "^5.1.0",
"[email protected]@kind-of": "^6.0.2",
"[email protected]@loader-runner": "^2.3.0",
"[email protected]@loader-utils": "^1.1.0",
"[email protected]@locate-path": "^2.0.0",
"[email protected]@lodash.debounce": "^4.0.8",
"[email protected]@long": "^3.2.0",
"[email protected]@lru-cache": "^4.1.3",
"[email protected]@long": "^4.0.0",
"[email protected]@mamacro": "^0.0.3",
"[email protected]@make-dir": "^1.3.0",
"[email protected]@map-cache": "^0.2.2",
"[email protected]@map-visit": "^1.0.0",
"[email protected]@md5.js": "^1.3.4",
"[email protected]@memory-fs": "^0.4.1",
"[email protected]@micromatch": "^3.1.10",
"[email protected]@miller-rabin": "^4.0.1",
"[email protected]@minimalistic-assert": "^1.0.1",
"[email protected]@minimalistic-crypto-utils": "^1.0.1",
"[email protected]@minimatch": "^3.0.4",
"[email protected]@minimist": "^0.0.8",
"[email protected]@mississippi": "^2.0.0",
"[email protected]@mkdirp": "^0.5.1",
"[email protected]@move-concurrently": "^1.0.1",
"[email protected]@mixin-deep": "^1.3.1",
"[email protected]@ms": "^2.0.0",
"[email protected]@nanomatch": "^1.2.13",
"[email protected]@neo-async": "^2.5.1",
"[email protected]@node-libs-browser": "^2.1.0",
"[email protected]@normalize-path": "^2.1.1",
"[email protected]@object-copy": "^0.1.0",
"[email protected]@object-visit": "^1.0.1",
"[email protected]@object.pick": "^1.3.0",
"[email protected]@once": "^1.4.0",
"[email protected]@os-browserify": "^0.3.0",
"[email protected]@p-limit": "^1.3.0",
"[email protected]@p-locate": "^2.0.0",
"[email protected]@p-try": "^1.0.0",
"[email protected]@pako": "^1.0.6",
"[email protected]@parse-asn1": "^5.1.1",
"[email protected]@pascalcase": "^0.1.1",
"[email protected]@path-browserify": "^0.0.0",
"[email protected]@path-dirname": "^1.0.2",
"[email protected]@path-exists": "^3.0.0",
"[email protected]@path-is-absolute": "^1.0.1",
"[email protected]@pbkdf2": "^3.0.16",
"[email protected]@pify": "^3.0.0",
"[email protected]@pkg-dir": "^2.0.0",
"[email protected]@posix-character-classes": "^0.1.1",
"[email protected]@process-nextick-args": "^2.0.0",
"[email protected]@process": "^0.11.10",
"[email protected]@promise-inflight": "^1.0.1",
"[email protected]@prr": "^1.0.1",
"[email protected]@parallel-transform": "^1.1.0",
"[email protected]@public-encrypt": "^4.0.2",
"[email protected]@pump": "^2.0.1",
"[email protected]@pumpify": "^1.5.1",
"[email protected]@punycode": "^1.3.2",
"[email protected]@punycode": "^1.4.1",
"[email protected]@punycode": "^2.1.1",
"[email protected]@querystring-es3": "^0.2.1",
"[email protected]@querystring": "^0.2.0",
"[email protected]@pseudomap": "^1.0.2",
"[email protected]@randomfill": "^1.0.4",
"[email protected]@readable-stream": "^2.3.6",
"[email protected]@readdirp": "^2.1.0",
"[email protected]@regex-not": "^1.0.2",
"[email protected]@remove-trailing-separator": "^1.1.0",
"[email protected]@repeat-element": "^1.1.2",
"[email protected]@repeat-string": "^1.6.1",
"[email protected]@resolve-url": "^0.2.1",
"[email protected]@ret": "^0.1.15",
"[email protected]@rimraf": "^2.6.2",
"[email protected]@ripemd160": "^2.0.2",
"[email protected]@run-queue": "^1.0.3",
"[email protected]@safe-buffer": "^5.1.2",
"[email protected]@safe-regex": "^1.1.0",
"[email protected]@schema-utils": "^0.4.7",
"[email protected]@serialize-javascript": "^1.5.0",
"[email protected]@set-immediate-shim": "^1.0.1",
"[email protected]@set-value": "^0.4.3",
"[email protected]@set-value": "^2.0.0",
"[email protected]@setimmediate": "^1.0.5",
"[email protected]@sha.js": "^2.4.11",
"[email protected]@snapdragon-node": "^2.1.1",
"[email protected]@snapdragon-util": "^3.0.1",
"[email protected]@snapdragon": "^0.8.2",
"[email protected]@source-list-map": "^2.0.0",
"[email protected]@source-map-resolve": "^0.5.2",
"[email protected]@source-map-url": "^0.4.0",
"[email protected]@source-map": "^0.5.7",
"[email protected]@source-map": "^0.6.1",
"[email protected]@split-string": "^3.1.0",
"[email protected]@ssri": "^5.3.0",
"[email protected]@static-extend": "^0.1.2",
"[email protected]@stream-browserify": "^2.0.1",
"[email protected]@stream-each": "^1.2.3",
"[email protected]@stream-http": "^2.8.3",
"[email protected]@stream-shift": "^1.0.0",
"[email protected]@string_decoder": "^1.1.1",
"[email protected]@tapable": "^1.0.0",
"[email protected]@through2": "^2.0.3",
"[email protected]@timers-browserify": "^2.0.10",
"[email protected]@to-arraybuffer": "^1.0.1",
"[email protected]@to-object-path": "^0.3.0",
"[email protected]@to-regex-range": "^2.1.1",
"[email protected]@to-regex": "^3.0.2",
"[email protected]@tslib": "^1.9.3",
"[email protected]@tty-browserify": "^0.0.0",
"[email protected]@typedarray": "^0.0.6",
"[email protected]@uglify-es": "^3.3.9",
"[email protected]@uglifyjs-webpack-plugin": "^1.2.7",
"[email protected]@union-value": "^1.0.0",
"[email protected]@unique-filename": "^1.1.0",
"[email protected]@unique-slug": "^2.0.0",
"[email protected]@unset-value": "^1.0.0",
"[email protected]@upath": "^1.1.0",
"[email protected]@uri-js": "^4.2.2",
"[email protected]@urix": "^0.1.0",
"[email protected]@url": "^0.11.0",
"[email protected]@use": "^3.1.1",
"[email protected]@util-deprecate": "^1.0.2",
"[email protected]@util": "^0.10.3",
"[email protected]@util": "^0.10.4",
"[email protected]@vm-browserify": "^0.0.4",
"[email protected]@watchpack": "^1.6.0",
"[email protected]@webpack-sources": "^1.1.0",
"[email protected]@webpack": "^4.16.5",
"[email protected]@worker-farm": "^1.6.0",
"[email protected]@wrappy": "^1.0.2",
"[email protected]@xtend": "^4.0.1",
"[email protected]@y18n": "^4.0.0",
"[email protected]@yallist": "^2.1.2",
"acorn": "^5.7.1",
"acorn-dynamic-import": "^3.0.0",
"ajv": "^6.5.2",
"ajv-keywords": "^3.2.0",
"anymatch": "^2.0.0",
"aproba": "^1.2.0",
"arr-diff": "^4.0.0",
"arr-flatten": "^1.1.0",
"arr-union": "^3.1.0",
"array-unique": "^0.3.2",
"assert": "^1.4.1",
"asn1.js": "^4.10.1",
"assign-symbols": "^1.0.0",
"async-each": "^1.0.1",
"atob": "^2.1.1",
"balanced-match": "^1.0.0",
"base": "^0.11.2",
"base64-js": "^1.3.0",
"big.js": "^3.2.0",
"bluebird": "^3.5.1",
"binary-extensions": "^1.11.0",
"bn.js": "^4.11.8",
"brace-expansion": "^1.1.11",
"braces": "^2.3.2",
"brorand": "^1.1.0",
"browserify-aes": "^1.2.0",
"browserify-cipher": "^1.0.1",
"browserify-des": "^1.0.2",
"browserify-rsa": "^4.0.1",
"browserify-sign": "^4.0.4",
"browserify-zlib": "^0.2.0",
"buffer": "^4.9.1",
"buffer-from": "^1.1.1",
"buffer-xor": "^1.0.3",
"builtin-status-codes": "^3.0.0",
"cacache": "^10.0.4",
"cache-base": "^1.0.1",
"chokidar": "^2.0.4",
"chownr": "^1.0.1",
"chrome-trace-event": "^1.0.0",
"cipher-base": "^1.0.4",
"class-utils": "^0.3.6",
"collection-visit": "^1.0.0",
"commander": "^2.13.0",
"commondir": "^1.0.1",
"component-emitter": "^1.2.1",
"concat-map": "^0.0.1",
"concat-stream": "^1.6.2",
"console-browserify": "^1.1.0",
"constants-browserify": "^1.0.0",
"copy-descriptor": "^0.1.1",
"copy-concurrently": "^1.0.5",
"core-util-is": "^1.0.2",
"create-ecdh": "^4.0.3",
"create-hash": "^1.2.0",
"crypto-browserify": "^3.12.0",
"cyclist": "^0.2.2",
"date-now": "^0.1.4",
"decode-uri-component": "^0.2.0",
"define-property": "^2.0.2",
"debug": "^3.1.0",
"des.js": "^1.0.0",
"create-hmac": "^1.1.7",
"domain-browser": "^1.2.0",
"duplexify": "^3.6.0",
"elliptic": "^6.4.1",
"emojis-list": "^2.1.0",
"end-of-stream": "^1.4.1",
"errno": "^0.1.7",
"enhanced-resolve": "^4.1.0",
"eslint-scope": "^4.0.0",
"esrecurse": "^4.2.1",
"estraverse": "^4.2.0",
"events": "^1.1.1",
"evp_bytestokey": "^1.0.3",
"expand-brackets": "^2.1.4",
"extend-shallow": "^3.0.2",
"extglob": "^2.0.4",
"diffie-hellman": "^5.0.3",
"fast-deep-equal": "^2.0.1",
"fast-json-stable-stringify": "^2.0.0",
"fill-range": "^4.0.0",
"find-cache-dir": "^1.0.0",
"flush-write-stream": "^1.0.3",
"find-up": "^2.1.0",
"fragment-cache": "^0.2.1",
"for-in": "^1.0.2",
"from2": "^2.3.0",
"fs-write-stream-atomic": "^1.0.10",
"fs.realpath": "^1.0.0",
"fsevents": "^1.2.4",
"get-value": "^2.0.6",
"glob": "^7.1.2",
"glob-parent": "^3.1.0",
"graceful-fs": "^4.1.11",
"has-value": "^1.0.0",
"has-values": "^1.0.0",
"hash-base": "^3.0.4",
"hash.js": "^1.1.5",
"https-browserify": "^1.0.0",
"hmac-drbg": "^1.0.1",
"ieee754": "^1.1.12",
"iferr": "^0.1.5",
"imurmurhash": "^0.1.4",
"indexof": "^0.0.1",
"inherits": "^2.0.3",
"inflight": "^1.0.6",
"is-accessor-descriptor": "^1.0.0",
"is-binary-path": "^1.0.1",
"is-buffer": "^1.1.6",
"is-data-descriptor": "^1.0.0",
"is-extendable": "^1.0.1",
"is-descriptor": "^1.0.2",
"is-extglob": "^2.1.1",
"is-glob": "^4.0.0",
"is-plain-object": "^2.0.4",
"is-number": "^3.0.0",
"isarray": "^1.0.0",
"is-windows": "^1.0.2",
"isobject": "^3.0.1",
"json-parse-better-errors": "^1.0.2",
"json5": "^0.5.1",
"json-schema-traverse": "^0.4.1",
"kind-of": "^6.0.2",
"loader-runner": "^2.3.0",
"loader-utils": "^1.1.0",
"locate-path": "^2.0.0",
"lodash.debounce": "^4.0.8",
"long": "^4.0.0",
"lru-cache": "^4.1.3",
"make-dir": "^1.3.0",
"mamacro": "^0.0.3",
"map-cache": "^0.2.2",
"map-visit": "^1.0.0",
"md5.js": "^1.3.4",
"memory-fs": "^0.4.1",
"micromatch": "^3.1.10",
"miller-rabin": "^4.0.1",
"minimalistic-assert": "^1.0.1",
"minimatch": "^3.0.4",
"minimalistic-crypto-utils": "^1.0.1",
"mississippi": "^2.0.0",
"minimist": "^0.0.8",
"mixin-deep": "^1.3.1",
"mkdirp": "^0.5.1",
"move-concurrently": "^1.0.1",
"ms": "^2.0.0",
"nanomatch": "^1.2.13",
"neo-async": "^2.5.1",
"node-libs-browser": "^2.1.0",
"normalize-path": "^2.1.1",
"object-visit": "^1.0.1",
"object-copy": "^0.1.0",
"once": "^1.4.0",
"object.pick": "^1.3.0",
"p-limit": "^1.3.0",
"os-browserify": "^0.3.0",
"p-locate": "^2.0.0",
"p-try": "^1.0.0",
"pako": "^1.0.6",
"parse-asn1": "^5.1.1",
"parallel-transform": "^1.1.0",
"pascalcase": "^0.1.1",
"path-browserify": "^0.0.0",
"path-dirname": "^1.0.2",
"path-exists": "^3.0.0",
"path-is-absolute": "^1.0.1",
"pbkdf2": "^3.0.16",
"pkg-dir": "^2.0.0",
"pify": "^3.0.0",
"posix-character-classes": "^0.1.1",
"promise-inflight": "^1.0.1",
"prr": "^1.0.1",
"process": "^0.11.10",
"pseudomap": "^1.0.2",
"process-nextick-args": "^2.0.0",
"pump": "^2.0.1",
"public-encrypt": "^4.0.2",
"pumpify": "^1.5.1",
"punycode": "^2.1.1",
"querystring": "^0.2.0",
"querystring-es3": "^0.2.1",
"randombytes": "^2.0.6",
"randomfill": "^1.0.4",
"readable-stream": "^2.3.6",
"readdirp": "^2.1.0",
"regex-not": "^1.0.2",
"remove-trailing-separator": "^1.1.0",
"repeat-element": "^1.1.2",
"repeat-string": "^1.6.1",
"resolve-url": "^0.2.1",
"ret": "^0.1.15",
"rimraf": "^2.6.2",
"ripemd160": "^2.0.2",
"run-queue": "^1.0.3",
"safe-buffer": "^5.1.2",
"safe-regex": "^1.1.0",
"schema-utils": "^0.4.7",
"serialize-javascript": "^1.5.0",
"set-immediate-shim": "^1.0.1",
"set-value": "^2.0.0",
"setimmediate": "^1.0.5",
"sha.js": "^2.4.11",
"snapdragon": "^0.8.2",
"snapdragon-util": "^3.0.1",
"snapdragon-node": "^2.1.1",
"source-list-map": "^2.0.0",
"source-map": "^0.6.1",
"source-map-resolve": "^0.5.2",
"source-map-url": "^0.4.0",
"split-string": "^3.1.0",
"ssri": "^5.3.0",
"static-extend": "^0.1.2",
"stream-browserify": "^2.0.1",
"stream-each": "^1.2.3",
"stream-http": "^2.8.3",
"stream-shift": "^1.0.0",
"string_decoder": "^1.1.1",
"tapable": "^1.0.0",
"through2": "^2.0.3",
"timers-browserify": "^2.0.10",
"to-arraybuffer": "^1.0.1",
"to-regex": "^3.0.2",
"to-regex-range": "^2.1.1",
"tslib": "^1.9.3",
"to-object-path": "^0.3.0",
"tty-browserify": "^0.0.0",
"uglify-es": "^3.3.9",
"uglifyjs-webpack-plugin": "^1.2.7",
"typedarray": "^0.0.6",
"[email protected]@randombytes": "^2.0.6",
"union-value": "^1.0.0",
"unique-filename": "^1.1.0",
"unique-slug": "^2.0.0",
"unset-value": "^1.0.0",
"upath": "^1.1.0",
"uri-js": "^4.2.2",
"urix": "^0.1.0",
"url": "^0.11.0",
"use": "^3.1.1",
"util": "^0.10.4",
"util-deprecate": "^1.0.2",
"vm-browserify": "^0.0.4",
"watchpack": "^1.6.0",
"webpack-sources": "^1.1.0",
"worker-farm": "^1.6.0",
"wrappy": "^1.0.2",
"xtend": "^4.0.1",
"yallist": "^2.1.2",
"y18n": "^4.0.0"
},
"scripts": {
"dev": "NODE_ENV=development webpack",
"prod": "NODE_ENV=production webpack",
"watch": "npm run build -- --watch"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}
index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
我的一个webpack
<div class="demo1"></div>
<div class="demo2"></div>
<!-- <script src="./dist/bundle.js"></script> -->
<!-- 代替上面的bundle.js,1以注入的方式 -->
<%=htmlWebpackPlugin.files.webpackManifest%>
</body>
</html>