直接上代码:
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": {
"_acorn-dynamic-import@3.0.0@acorn-dynamic-import": "^3.0.0",
"_acorn@5.7.1@acorn": "^5.7.1",
"_ajv-keywords@3.2.0@ajv-keywords": "^3.2.0",
"_ajv@6.5.2@ajv": "^6.5.2",
"_anymatch@2.0.0@anymatch": "^2.0.0",
"_aproba@1.2.0@aproba": "^1.2.0",
"_arr-flatten@1.1.0@arr-flatten": "^1.1.0",
"_arr-diff@4.0.0@arr-diff": "^4.0.0",
"_arr-union@3.1.0@arr-union": "^3.1.0",
"_array-unique@0.3.2@array-unique": "^0.3.2",
"_assert@1.4.1@assert": "^1.4.1",
"_asn1.js@4.10.1@asn1.js": "^4.10.1",
"_assign-symbols@1.0.0@assign-symbols": "^1.0.0",
"_async-each@1.0.1@async-each": "^1.0.1",
"_atob@2.1.1@atob": "^2.1.1",
"_balanced-match@1.0.0@balanced-match": "^1.0.0",
"_base@0.11.2@base": "^0.11.2",
"_base64-js@1.3.0@base64-js": "^1.3.0",
"_big.js@3.2.0@big.js": "^3.2.0",
"_binary-extensions@1.11.0@binary-extensions": "^1.11.0",
"_bluebird@3.5.1@bluebird": "^3.5.1",
"_bn.js@4.11.8@bn.js": "^4.11.8",
"_brace-expansion@1.1.11@brace-expansion": "^1.1.11",
"_braces@2.3.2@braces": "^2.3.2",
"_brorand@1.1.0@brorand": "^1.1.0",
"_browserify-cipher@1.0.1@browserify-cipher": "^1.0.1",
"_browserify-des@1.0.2@browserify-des": "^1.0.2",
"_browserify-rsa@4.0.1@browserify-rsa": "^4.0.1",
"_browserify-sign@4.0.4@browserify-sign": "^4.0.4",
"_browserify-aes@1.2.0@browserify-aes": "^1.2.0",
"_browserify-zlib@0.2.0@browserify-zlib": "^0.2.0",
"_buffer-from@1.1.1@buffer-from": "^1.1.1",
"_buffer-xor@1.0.3@buffer-xor": "^1.0.3",
"_builtin-status-codes@3.0.0@builtin-status-codes": "^3.0.0",
"_cacache@10.0.4@cacache": "^10.0.4",
"_cache-base@1.0.1@cache-base": "^1.0.1",
"_chokidar@2.0.4@chokidar": "^2.0.4",
"_buffer@4.9.1@buffer": "^4.9.1",
"_chownr@1.0.1@chownr": "^1.0.1",
"_chrome-trace-event@1.0.0@chrome-trace-event": "^1.0.0",
"_cipher-base@1.0.4@cipher-base": "^1.0.4",
"_collection-visit@1.0.0@collection-visit": "^1.0.0",
"_commander@2.13.0@commander": "^2.13.0",
"_commondir@1.0.1@commondir": "^1.0.1",
"_component-emitter@1.2.1@component-emitter": "^1.2.1",
"_concat-map@0.0.1@concat-map": "^0.0.1",
"_class-utils@0.3.6@class-utils": "^0.3.6",
"_concat-stream@1.6.2@concat-stream": "^1.6.2",
"_console-browserify@1.1.0@console-browserify": "^1.1.0",
"_constants-browserify@1.0.0@constants-browserify": "^1.0.0",
"_copy-concurrently@1.0.5@copy-concurrently": "^1.0.5",
"_copy-descriptor@0.1.1@copy-descriptor": "^0.1.1",
"_core-util-is@1.0.2@core-util-is": "^1.0.2",
"_create-ecdh@4.0.3@create-ecdh": "^4.0.3",
"_create-hash@1.2.0@create-hash": "^1.2.0",
"_create-hmac@1.1.7@create-hmac": "^1.1.7",
"_cyclist@0.2.2@cyclist": "^0.2.2",
"_crypto-browserify@3.12.0@crypto-browserify": "^3.12.0",
"_date-now@0.1.4@date-now": "^0.1.4",
"_debug@2.6.9@debug": "^2.6.9",
"_debug@3.1.0@debug": "^3.1.0",
"_decode-uri-component@0.2.0@decode-uri-component": "^0.2.0",
"_define-property@0.2.5@define-property": "^0.2.5",
"_define-property@1.0.0@define-property": "^1.0.0",
"_define-property@2.0.2@define-property": "^2.0.2",
"_des.js@1.0.0@des.js": "^1.0.0",
"_domain-browser@1.2.0@domain-browser": "^1.2.0",
"_diffie-hellman@5.0.3@diffie-hellman": "^5.0.3",
"_duplexify@3.6.0@duplexify": "^3.6.0",
"_elliptic@6.4.1@elliptic": "^6.4.1",
"_emojis-list@2.1.0@emojis-list": "^2.1.0",
"_end-of-stream@1.4.1@end-of-stream": "^1.4.1",
"_enhanced-resolve@4.1.0@enhanced-resolve": "^4.1.0",
"_errno@0.1.7@errno": "^0.1.7",
"_eslint-scope@4.0.0@eslint-scope": "^4.0.0",
"_esrecurse@4.2.1@esrecurse": "^4.2.1",
"_estraverse@4.2.0@estraverse": "^4.2.0",
"_events@1.1.1@events": "^1.1.1",
"_evp_bytestokey@1.0.3@evp_bytestokey": "^1.0.3",
"_expand-brackets@2.1.4@expand-brackets": "^2.1.4",
"_extend-shallow@3.0.2@extend-shallow": "^3.0.2",
"_extglob@2.0.4@extglob": "^2.0.4",
"_fast-deep-equal@2.0.1@fast-deep-equal": "^2.0.1",
"_fast-json-stable-stringify@2.0.0@fast-json-stable-stringify": "^2.0.0",
"_extend-shallow@2.0.1@extend-shallow": "^2.0.1",
"_fill-range@4.0.0@fill-range": "^4.0.0",
"_find-cache-dir@1.0.0@find-cache-dir": "^1.0.0",
"_find-up@2.1.0@find-up": "^2.1.0",
"_flush-write-stream@1.0.3@flush-write-stream": "^1.0.3",
"_for-in@1.0.2@for-in": "^1.0.2",
"_fragment-cache@0.2.1@fragment-cache": "^0.2.1",
"_from2@2.3.0@from2": "^2.3.0",
"_fs-write-stream-atomic@1.0.10@fs-write-stream-atomic": "^1.0.10",
"_fs.realpath@1.0.0@fs.realpath": "^1.0.0",
"_fsevents@1.2.4@fsevents": "^1.2.4",
"_get-value@2.0.6@get-value": "^2.0.6",
"_graceful-fs@4.1.11@graceful-fs": "^4.1.11",
"_glob@7.1.2@glob": "^7.1.2",
"_has-value@0.3.1@has-value": "^0.3.1",
"_glob-parent@3.1.0@glob-parent": "^3.1.0",
"_has-value@1.0.0@has-value": "^1.0.0",
"_has-values@0.1.4@has-values": "^0.1.4",
"_has-values@1.0.0@has-values": "^1.0.0",
"_hash-base@3.0.4@hash-base": "^3.0.4",
"_hash.js@1.1.5@hash.js": "^1.1.5",
"_hmac-drbg@1.0.1@hmac-drbg": "^1.0.1",
"_https-browserify@1.0.0@https-browserify": "^1.0.0",
"_ieee754@1.1.12@ieee754": "^1.1.12",
"_iferr@0.1.5@iferr": "^0.1.5",
"_imurmurhash@0.1.4@imurmurhash": "^0.1.4",
"_indexof@0.0.1@indexof": "^0.0.1",
"_inflight@1.0.6@inflight": "^1.0.6",
"_inherits@2.0.1@inherits": "^2.0.1",
"_inherits@2.0.3@inherits": "^2.0.3",
"_is-accessor-descriptor@0.1.6@is-accessor-descriptor": "^0.1.6",
"_is-accessor-descriptor@1.0.0@is-accessor-descriptor": "^1.0.0",
"_is-binary-path@1.0.1@is-binary-path": "^1.0.1",
"_is-buffer@1.1.6@is-buffer": "^1.1.6",
"_is-data-descriptor@0.1.4@is-data-descriptor": "^0.1.4",
"_is-data-descriptor@1.0.0@is-data-descriptor": "^1.0.0",
"_is-descriptor@0.1.6@is-descriptor": "^0.1.6",
"_is-extendable@0.1.1@is-extendable": "^0.1.1",
"_is-extendable@1.0.1@is-extendable": "^1.0.1",
"_is-extglob@2.1.1@is-extglob": "^2.1.1",
"_is-glob@3.1.0@is-glob": "^3.1.0",
"_is-glob@4.0.0@is-glob": "^4.0.0",
"_is-number@3.0.0@is-number": "^3.0.0",
"_is-plain-object@2.0.4@is-plain-object": "^2.0.4",
"_is-windows@1.0.2@is-windows": "^1.0.2",
"_isobject@2.1.0@isobject": "^2.1.0",
"_isarray@1.0.0@isarray": "^1.0.0",
"_isobject@3.0.1@isobject": "^3.0.1",
"_is-descriptor@1.0.2@is-descriptor": "^1.0.2",
"_json-parse-better-errors@1.0.2@json-parse-better-errors": "^1.0.2",
"_json-schema-traverse@0.4.1@json-schema-traverse": "^0.4.1",
"_json5@0.5.1@json5": "^0.5.1",
"_kind-of@4.0.0@kind-of": "^4.0.0",
"_kind-of@3.2.2@kind-of": "^3.2.2",
"_kind-of@5.1.0@kind-of": "^5.1.0",
"_kind-of@6.0.2@kind-of": "^6.0.2",
"_loader-runner@2.3.0@loader-runner": "^2.3.0",
"_loader-utils@1.1.0@loader-utils": "^1.1.0",
"_locate-path@2.0.0@locate-path": "^2.0.0",
"_lodash.debounce@4.0.8@lodash.debounce": "^4.0.8",
"_long@3.2.0@long": "^3.2.0",
"_lru-cache@4.1.3@lru-cache": "^4.1.3",
"_long@4.0.0@long": "^4.0.0",
"_mamacro@0.0.3@mamacro": "^0.0.3",
"_make-dir@1.3.0@make-dir": "^1.3.0",
"_map-cache@0.2.2@map-cache": "^0.2.2",
"_map-visit@1.0.0@map-visit": "^1.0.0",
"_md5.js@1.3.4@md5.js": "^1.3.4",
"_memory-fs@0.4.1@memory-fs": "^0.4.1",
"_micromatch@3.1.10@micromatch": "^3.1.10",
"_miller-rabin@4.0.1@miller-rabin": "^4.0.1",
"_minimalistic-assert@1.0.1@minimalistic-assert": "^1.0.1",
"_minimalistic-crypto-utils@1.0.1@minimalistic-crypto-utils": "^1.0.1",
"_minimatch@3.0.4@minimatch": "^3.0.4",
"_minimist@0.0.8@minimist": "^0.0.8",
"_mississippi@2.0.0@mississippi": "^2.0.0",
"_mkdirp@0.5.1@mkdirp": "^0.5.1",
"_move-concurrently@1.0.1@move-concurrently": "^1.0.1",
"_mixin-deep@1.3.1@mixin-deep": "^1.3.1",
"_ms@2.0.0@ms": "^2.0.0",
"_nanomatch@1.2.13@nanomatch": "^1.2.13",
"_neo-async@2.5.1@neo-async": "^2.5.1",
"_node-libs-browser@2.1.0@node-libs-browser": "^2.1.0",
"_normalize-path@2.1.1@normalize-path": "^2.1.1",
"_object-copy@0.1.0@object-copy": "^0.1.0",
"_object-visit@1.0.1@object-visit": "^1.0.1",
"_object.pick@1.3.0@object.pick": "^1.3.0",
"_once@1.4.0@once": "^1.4.0",
"_os-browserify@0.3.0@os-browserify": "^0.3.0",
"_p-limit@1.3.0@p-limit": "^1.3.0",
"_p-locate@2.0.0@p-locate": "^2.0.0",
"_p-try@1.0.0@p-try": "^1.0.0",
"_pako@1.0.6@pako": "^1.0.6",
"_parse-asn1@5.1.1@parse-asn1": "^5.1.1",
"_pascalcase@0.1.1@pascalcase": "^0.1.1",
"_path-browserify@0.0.0@path-browserify": "^0.0.0",
"_path-dirname@1.0.2@path-dirname": "^1.0.2",
"_path-exists@3.0.0@path-exists": "^3.0.0",
"_path-is-absolute@1.0.1@path-is-absolute": "^1.0.1",
"_pbkdf2@3.0.16@pbkdf2": "^3.0.16",
"_pify@3.0.0@pify": "^3.0.0",
"_pkg-dir@2.0.0@pkg-dir": "^2.0.0",
"_posix-character-classes@0.1.1@posix-character-classes": "^0.1.1",
"_process-nextick-args@2.0.0@process-nextick-args": "^2.0.0",
"_process@0.11.10@process": "^0.11.10",
"_promise-inflight@1.0.1@promise-inflight": "^1.0.1",
"_prr@1.0.1@prr": "^1.0.1",
"_parallel-transform@1.1.0@parallel-transform": "^1.1.0",
"_public-encrypt@4.0.2@public-encrypt": "^4.0.2",
"_pump@2.0.1@pump": "^2.0.1",
"_pumpify@1.5.1@pumpify": "^1.5.1",
"_punycode@1.3.2@punycode": "^1.3.2",
"_punycode@1.4.1@punycode": "^1.4.1",
"_punycode@2.1.1@punycode": "^2.1.1",
"_querystring-es3@0.2.1@querystring-es3": "^0.2.1",
"_querystring@0.2.0@querystring": "^0.2.0",
"_pseudomap@1.0.2@pseudomap": "^1.0.2",
"_randomfill@1.0.4@randomfill": "^1.0.4",
"_readable-stream@2.3.6@readable-stream": "^2.3.6",
"_readdirp@2.1.0@readdirp": "^2.1.0",
"_regex-not@1.0.2@regex-not": "^1.0.2",
"_remove-trailing-separator@1.1.0@remove-trailing-separator": "^1.1.0",
"_repeat-element@1.1.2@repeat-element": "^1.1.2",
"_repeat-string@1.6.1@repeat-string": "^1.6.1",
"_resolve-url@0.2.1@resolve-url": "^0.2.1",
"_ret@0.1.15@ret": "^0.1.15",
"_rimraf@2.6.2@rimraf": "^2.6.2",
"_ripemd160@2.0.2@ripemd160": "^2.0.2",
"_run-queue@1.0.3@run-queue": "^1.0.3",
"_safe-buffer@5.1.2@safe-buffer": "^5.1.2",
"_safe-regex@1.1.0@safe-regex": "^1.1.0",
"_schema-utils@0.4.7@schema-utils": "^0.4.7",
"_serialize-javascript@1.5.0@serialize-javascript": "^1.5.0",
"_set-immediate-shim@1.0.1@set-immediate-shim": "^1.0.1",
"_set-value@0.4.3@set-value": "^0.4.3",
"_set-value@2.0.0@set-value": "^2.0.0",
"_setimmediate@1.0.5@setimmediate": "^1.0.5",
"_sha.js@2.4.11@sha.js": "^2.4.11",
"_snapdragon-node@2.1.1@snapdragon-node": "^2.1.1",
"_snapdragon-util@3.0.1@snapdragon-util": "^3.0.1",
"_snapdragon@0.8.2@snapdragon": "^0.8.2",
"_source-list-map@2.0.0@source-list-map": "^2.0.0",
"_source-map-resolve@0.5.2@source-map-resolve": "^0.5.2",
"_source-map-url@0.4.0@source-map-url": "^0.4.0",
"_source-map@0.5.7@source-map": "^0.5.7",
"_source-map@0.6.1@source-map": "^0.6.1",
"_split-string@3.1.0@split-string": "^3.1.0",
"_ssri@5.3.0@ssri": "^5.3.0",
"_static-extend@0.1.2@static-extend": "^0.1.2",
"_stream-browserify@2.0.1@stream-browserify": "^2.0.1",
"_stream-each@1.2.3@stream-each": "^1.2.3",
"_stream-http@2.8.3@stream-http": "^2.8.3",
"_stream-shift@1.0.0@stream-shift": "^1.0.0",
"_string_decoder@1.1.1@string_decoder": "^1.1.1",
"_tapable@1.0.0@tapable": "^1.0.0",
"_through2@2.0.3@through2": "^2.0.3",
"_timers-browserify@2.0.10@timers-browserify": "^2.0.10",
"_to-arraybuffer@1.0.1@to-arraybuffer": "^1.0.1",
"_to-object-path@0.3.0@to-object-path": "^0.3.0",
"_to-regex-range@2.1.1@to-regex-range": "^2.1.1",
"_to-regex@3.0.2@to-regex": "^3.0.2",
"_tslib@1.9.3@tslib": "^1.9.3",
"_tty-browserify@0.0.0@tty-browserify": "^0.0.0",
"_typedarray@0.0.6@typedarray": "^0.0.6",
"_uglify-es@3.3.9@uglify-es": "^3.3.9",
"_uglifyjs-webpack-plugin@1.2.7@uglifyjs-webpack-plugin": "^1.2.7",
"_union-value@1.0.0@union-value": "^1.0.0",
"_unique-filename@1.1.0@unique-filename": "^1.1.0",
"_unique-slug@2.0.0@unique-slug": "^2.0.0",
"_unset-value@1.0.0@unset-value": "^1.0.0",
"_upath@1.1.0@upath": "^1.1.0",
"_uri-js@4.2.2@uri-js": "^4.2.2",
"_urix@0.1.0@urix": "^0.1.0",
"_url@0.11.0@url": "^0.11.0",
"_use@3.1.1@use": "^3.1.1",
"_util-deprecate@1.0.2@util-deprecate": "^1.0.2",
"_util@0.10.3@util": "^0.10.3",
"_util@0.10.4@util": "^0.10.4",
"_vm-browserify@0.0.4@vm-browserify": "^0.0.4",
"_watchpack@1.6.0@watchpack": "^1.6.0",
"_webpack-sources@1.1.0@webpack-sources": "^1.1.0",
"_webpack@4.16.5@webpack": "^4.16.5",
"_worker-farm@1.6.0@worker-farm": "^1.6.0",
"_wrappy@1.0.2@wrappy": "^1.0.2",
"_xtend@4.0.1@xtend": "^4.0.1",
"_y18n@4.0.0@y18n": "^4.0.0",
"_yallist@2.1.2@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",
"_randombytes@2.0.6@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>