Commit b17a15cc authored by 郭学岭's avatar 郭学岭

Initial commit

parent 5571d4e4
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-transform-runtime",
"@babel/plugin-proposal-class-properties"
]
}
# Project introduction..
## Project setup
```
npm i xxx
```
### Compiles for development
\ No newline at end of file
{"name": "audio_react",
"version": "1.0.3",
"description": "",
"main": "index.js",
"entry":"./src",
"output":"./lib",
"publicPath":"publicPath",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
// webpack 4+;
// 自动化多规则出入口配置;
const path = require('path');
const fs = require('fs');
const frameurl = './frameConfig/package.json';
const readme = './frameConfig/README.md';
const packageConfig = require(frameurl);
const frameConfig = {
entryPath: packageConfig.entry,
outputPath: packageConfig.output,
framename: packageConfig.name,
publicPath: packageConfig.publicPath,
};
let files = [],filesPathArr = {};
function getDirectories(filepath) {
if (fs.existsSync(filepath)) {
files = fs.readdirSync(filepath);
files.forEach(function (file, index) {
let newPath = filepath + '/' + file;
const filelit = file.split(".");
const surplus = filelit.slice(0, filelit.length - 1);
const filepathSplit = filepath.replace(frameConfig.entryPath, '');
const newFilePath = filepathSplit + '/' + surplus.join('.');
if (fs.statSync(newPath).isDirectory()) {
if (file != "assets") {
getDirectories(newPath);
}
} else {
if (file != '.DS_Store') {
filesPathArr[newFilePath] = newPath;
}
}
})
if (!fs.existsSync(frameConfig.outputPath)) {
fs.mkdirSync(frameConfig.outputPath);
}
const packageJson = fs.readFileSync(frameurl);
const readmeDoc = fs.readFileSync(readme);
fs.writeFileSync(path.resolve(frameConfig.outputPath, 'package.json'), packageJson);
fs.writeFileSync(path.resolve(frameConfig.outputPath, 'README.md'), readmeDoc);
return filesPathArr;
} else {
console.error('定义的入口路径不存在');
return [];
}
}
module.exports = {
entry: getDirectories(frameConfig.entryPath),
output: {
pathinfo: true,
filename: '[name].js',
chunkFilename: '[name].js',
path: path.resolve(__dirname, frameConfig.outputPath),
publicPath: frameConfig.publicPath,
library: frameConfig.framename,
libraryTarget: 'umd',
umdNamedDefine: true
}
}
\ No newline at end of file
This diff is collapsed.
/*! !../../node_modules/css-loader/dist/cjs.js!./App.css */
/*! ../../node_modules/css-loader/dist/runtime/api.js */
/*! ../../node_modules/style-loader/lib/addStyles.js */
/*! ./assets/App.css */
/*! ./assets/logo.svg */
/*! ./urls */
/*! ModuleConcatenation bailout: Module is an entry point */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
/*! all exports used */
/*! exports provided: default */
/*! exports used: default */
/*! exports used: default, useCallback, useEffect, useMemo, useState */
/*! no static exports found */
/*! react */
/*!**********************!*\
!*** ./src/Child.js ***!
\**********************/
/*!************************!*\
!*** external "react" ***!
\************************/
/*!****************************!*\
!*** ./src/assets/App.css ***!
\****************************/
/*!*****************************!*\
!*** ./src/assets/logo.svg ***!
\*****************************/
/*!***********************************************!*\
!*** ./node_modules/style-loader/lib/urls.js ***!
\***********************************************/
/*!****************************************************!*\
!*** ./node_modules/style-loader/lib/addStyles.js ***!
\****************************************************/
/*!*****************************************************!*\
!*** ./node_modules/css-loader/dist/runtime/api.js ***!
\*****************************************************/
/*!******************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./src/assets/App.css ***!
\******************************************************************/
This diff is collapsed.
/*! !../../node_modules/css-loader/dist/cjs.js!./App.css */
/*! ../../node_modules/css-loader/dist/runtime/api.js */
/*! ../../node_modules/style-loader/lib/addStyles.js */
/*! ./Child */
/*! ./arrayLikeToArray */
/*! ./arrayWithHoles */
/*! ./assets/App.css */
/*! ./assets/logo.svg */
/*! ./iterableToArrayLimit */
/*! ./nonIterableRest */
/*! ./unsupportedIterableToArray */
/*! ./urls */
/*! @babel/runtime/helpers/slicedToArray */
/*! ModuleConcatenation bailout: Module is an entry point */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
/*! all exports used */
/*! exports provided: default */
/*! exports used: default */
/*! exports used: default, useCallback, useEffect, useMemo, useState */
/*! no static exports found */
/*! react */
/*!**********************!*\
!*** ./src/Child.js ***!
\**********************/
/*!**********************!*\
!*** ./src/Hooky.js ***!
\**********************/
/*!************************!*\
!*** external "react" ***!
\************************/
/*!****************************!*\
!*** ./src/assets/App.css ***!
\****************************/
/*!*****************************!*\
!*** ./src/assets/logo.svg ***!
\*****************************/
/*!***********************************************!*\
!*** ./node_modules/style-loader/lib/urls.js ***!
\***********************************************/
/*!****************************************************!*\
!*** ./node_modules/style-loader/lib/addStyles.js ***!
\****************************************************/
/*!*****************************************************!*\
!*** ./node_modules/css-loader/dist/runtime/api.js ***!
\*****************************************************/
/*!**************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
\**************************************************************/
/*!***************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
\***************************************************************/
/*!****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
\****************************************************************/
/*!*****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
\*****************************************************************/
/*!******************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./src/assets/App.css ***!
\******************************************************************/
/*!*********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
\*********************************************************************/
/*!***************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
\***************************************************************************/
# Project introduction..
## Project setup
```
npm i xxx
```
### Compiles for development
\ No newline at end of file
This diff is collapsed.
/*! !../../node_modules/css-loader/dist/cjs.js!./App.css */
/*! ../../node_modules/css-loader/dist/runtime/api.js */
/*! ../../node_modules/style-loader/lib/addStyles.js */
/*! ./Child */
/*! ./Hooky */
/*! ./arrayLikeToArray */
/*! ./arrayWithHoles */
/*! ./assets/App.css */
/*! ./assets/logo.svg */
/*! ./iterableToArrayLimit */
/*! ./nonIterableRest */
/*! ./unsupportedIterableToArray */
/*! ./urls */
/*! @babel/runtime/helpers/slicedToArray */
/*! ModuleConcatenation bailout: Module is an entry point */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
/*! all exports used */
/*! exports provided: Hooky */
/*! exports provided: default */
/*! exports used: default */
/*! exports used: default, useCallback, useEffect, useMemo, useState */
/*! no static exports found */
/*! react */
/*!**********************!*\
!*** ./src/Child.js ***!
\**********************/
/*!**********************!*\
!*** ./src/Hooky.js ***!
\**********************/
/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
/*!************************!*\
!*** external "react" ***!
\************************/
/*!****************************!*\
!*** ./src/assets/App.css ***!
\****************************/
/*!*****************************!*\
!*** ./src/assets/logo.svg ***!
\*****************************/
/*!***********************************************!*\
!*** ./node_modules/style-loader/lib/urls.js ***!
\***********************************************/
/*!****************************************************!*\
!*** ./node_modules/style-loader/lib/addStyles.js ***!
\****************************************************/
/*!*****************************************************!*\
!*** ./node_modules/css-loader/dist/runtime/api.js ***!
\*****************************************************/
/*!**************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
\**************************************************************/
/*!***************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
\***************************************************************/
/*!****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
\****************************************************************/
/*!*****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
\*****************************************************************/
/*!******************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./src/assets/App.css ***!
\******************************************************************/
/*!*********************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
\*********************************************************************/
/*!***************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
\***************************************************************************/
{"name": "audio_react",
"version": "1.0.3",
"description": "",
"main": "index.js",
"entry":"./src",
"output":"./lib",
"publicPath":"publicPath",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
/*! For license information please see serviceWorker.js.LICENSE.txt */
!function webpackUniversalModuleDefinition(root,factory){"object"==typeof exports&&"object"==typeof module?module.exports=factory():"function"==typeof define&&define.amd?define("audio_react",[],factory):"object"==typeof exports?exports.audio_react=factory():root.audio_react=factory()}(window,(function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{enumerable:!0,get:getter})},__webpack_require__.r=function(exports){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.t=function(value,mode){if(1&mode&&(value=__webpack_require__(value)),8&mode)return value;if(4&mode&&"object"==typeof value&&value&&value.__esModule)return value;var ns=Object.create(null);if(__webpack_require__.r(ns),Object.defineProperty(ns,"default",{enumerable:!0,value:value}),2&mode&&"string"!=typeof value)for(var key in value)__webpack_require__.d(ns,key,function(key){return value[key]}.bind(null,key));return ns},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module.default}:function getModuleExports(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="publicPath",__webpack_require__(__webpack_require__.s=66)}({14:function(module,exports){var cachedSetTimeout,cachedClearTimeout,process=module.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(marker);try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(name){return[]},process.binding=function(name){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(dir){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}},66:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__),function(process){__webpack_require__.d(__webpack_exports__,"register",(function(){return register})),__webpack_require__.d(__webpack_exports__,"unregister",(function(){return unregister}));var isLocalhost=Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function register(config){if("serviceWorker"in navigator){if(new URL(process.env.PUBLIC_URL,window.location.href).origin!==window.location.origin)return;window.addEventListener("load",(function(){var swUrl="".concat(process.env.PUBLIC_URL,"/service-worker.js");isLocalhost?(!function checkValidServiceWorker(swUrl,config){fetch(swUrl,{headers:{"Service-Worker":"script"}}).then((function(response){var contentType=response.headers.get("content-type");404===response.status||null!=contentType&&-1===contentType.indexOf("javascript")?navigator.serviceWorker.ready.then((function(registration){registration.unregister().then((function(){window.location.reload()}))})):registerValidSW(swUrl,config)})).catch((function(){console.log("No internet connection found. App is running in offline mode.")}))}(swUrl,config),navigator.serviceWorker.ready.then((function(){console.log("This web app is being served cache-first by a service worker. To learn more, visit https://bit.ly/CRA-PWA")}))):registerValidSW(swUrl,config)}))}}function registerValidSW(swUrl,config){navigator.serviceWorker.register(swUrl).then((function(registration){registration.onupdatefound=function(){var installingWorker=registration.installing;null!=installingWorker&&(installingWorker.onstatechange=function(){"installed"===installingWorker.state&&(navigator.serviceWorker.controller?(console.log("New content is available and will be used when all tabs for this page are closed. See https://bit.ly/CRA-PWA."),config&&config.onUpdate&&config.onUpdate(registration)):(console.log("Content is cached for offline use."),config&&config.onSuccess&&config.onSuccess(registration)))})}})).catch((function(error){console.error("Error during service worker registration:",error)}))}function unregister(){"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(registration){registration.unregister()})).catch((function(error){console.error(error.message)}))}}.call(this,__webpack_require__(14))}})}));
\ No newline at end of file
/*! ./../../../../../../usr/local/lib/node_modules/webpack/node_modules/process/browser.js */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
/*! ModuleConcatenation bailout: Module uses injected variables (process) */
/*! all exports used */
/*! exports provided: register, unregister */
/*! no static exports found */
/*!******************************!*\
!*** ./src/serviceWorker.js ***!
\******************************/
/*!*************************************************!*\
!*** (webpack)/node_modules/process/browser.js ***!
\*************************************************/
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -30,23 +30,23 @@ ...@@ -30,23 +30,23 @@
} }
}, },
"@babel/core": { "@babel/core": {
"version": "7.9.0", "version": "7.11.6",
"resolved": "https://registry.npm.taobao.org/@babel/core/download/@babel/core-7.9.0.tgz?cache=0&sync_timestamp=1599146827519&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fcore%2Fdownload%2F%40babel%2Fcore-7.9.0.tgz", "resolved": "https://registry.npm.taobao.org/@babel/core/download/@babel/core-7.11.6.tgz?cache=0&sync_timestamp=1599146827519&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fcore%2Fdownload%2F%40babel%2Fcore-7.11.6.tgz",
"integrity": "sha1-rJd7U4t34TL/cG87ik260JwDxW4=", "integrity": "sha1-OpRV3HOH/xusRXcGULwTugShVlE=",
"requires": { "requires": {
"@babel/code-frame": "^7.8.3", "@babel/code-frame": "^7.10.4",
"@babel/generator": "^7.9.0", "@babel/generator": "^7.11.6",
"@babel/helper-module-transforms": "^7.9.0", "@babel/helper-module-transforms": "^7.11.0",
"@babel/helpers": "^7.9.0", "@babel/helpers": "^7.10.4",
"@babel/parser": "^7.9.0", "@babel/parser": "^7.11.5",
"@babel/template": "^7.8.6", "@babel/template": "^7.10.4",
"@babel/traverse": "^7.9.0", "@babel/traverse": "^7.11.5",
"@babel/types": "^7.9.0", "@babel/types": "^7.11.5",
"convert-source-map": "^1.7.0", "convert-source-map": "^1.7.0",
"debug": "^4.1.0", "debug": "^4.1.0",
"gensync": "^1.0.0-beta.1", "gensync": "^1.0.0-beta.1",
"json5": "^2.1.2", "json5": "^2.1.2",
"lodash": "^4.17.13", "lodash": "^4.17.19",
"resolve": "^1.3.2", "resolve": "^1.3.2",
"semver": "^5.4.1", "semver": "^5.4.1",
"source-map": "^0.5.0" "source-map": "^0.5.0"
...@@ -2763,6 +2763,29 @@ ...@@ -2763,6 +2763,29 @@
"babel-plugin-transform-react-remove-prop-types": "0.4.24" "babel-plugin-transform-react-remove-prop-types": "0.4.24"
}, },
"dependencies": { "dependencies": {
"@babel/core": {
"version": "7.9.0",
"resolved": "https://registry.npm.taobao.org/@babel/core/download/@babel/core-7.9.0.tgz?cache=0&sync_timestamp=1599146827519&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fcore%2Fdownload%2F%40babel%2Fcore-7.9.0.tgz",
"integrity": "sha1-rJd7U4t34TL/cG87ik260JwDxW4=",
"requires": {
"@babel/code-frame": "^7.8.3",
"@babel/generator": "^7.9.0",
"@babel/helper-module-transforms": "^7.9.0",
"@babel/helpers": "^7.9.0",
"@babel/parser": "^7.9.0",
"@babel/template": "^7.8.6",
"@babel/traverse": "^7.9.0",
"@babel/types": "^7.9.0",
"convert-source-map": "^1.7.0",
"debug": "^4.1.0",
"gensync": "^1.0.0-beta.1",
"json5": "^2.1.2",
"lodash": "^4.17.13",
"resolve": "^1.3.2",
"semver": "^5.4.1",
"source-map": "^0.5.0"
}
},
"@babel/plugin-proposal-class-properties": { "@babel/plugin-proposal-class-properties": {
"version": "7.8.3", "version": "7.8.3",
"resolved": "https://registry.npm.taobao.org/@babel/plugin-proposal-class-properties/download/@babel/plugin-proposal-class-properties-7.8.3.tgz?cache=0&sync_timestamp=1593522937004&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fplugin-proposal-class-properties%2Fdownload%2F%40babel%2Fplugin-proposal-class-properties-7.8.3.tgz", "resolved": "https://registry.npm.taobao.org/@babel/plugin-proposal-class-properties/download/@babel/plugin-proposal-class-properties-7.8.3.tgz?cache=0&sync_timestamp=1593522937004&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fplugin-proposal-class-properties%2Fdownload%2F%40babel%2Fplugin-proposal-class-properties-7.8.3.tgz",
...@@ -2899,6 +2922,11 @@ ...@@ -2899,6 +2922,11 @@
"version": "5.7.1", "version": "5.7.1",
"resolved": "https://registry.npm.taobao.org/semver/download/semver-5.7.1.tgz?cache=0&sync_timestamp=1586886267748&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-5.7.1.tgz", "resolved": "https://registry.npm.taobao.org/semver/download/semver-5.7.1.tgz?cache=0&sync_timestamp=1586886267748&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-5.7.1.tgz",
"integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=" "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc="
},
"source-map": {
"version": "0.5.7",
"resolved": "https://registry.npm.taobao.org/source-map/download/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
} }
} }
}, },
...@@ -10264,6 +10292,61 @@ ...@@ -10264,6 +10292,61 @@
"resolved": "https://registry.npm.taobao.org/progress/download/progress-2.0.3.tgz", "resolved": "https://registry.npm.taobao.org/progress/download/progress-2.0.3.tgz",
"integrity": "sha1-foz42PW48jnBvGi+tOt4Vn1XLvg=" "integrity": "sha1-foz42PW48jnBvGi+tOt4Vn1XLvg="
}, },
"progress-bar-webpack-plugin": {
"version": "2.1.0",
"resolved": "http://192.168.0.63:4873/progress-bar-webpack-plugin/-/progress-bar-webpack-plugin-2.1.0.tgz",
"integrity": "sha1-9/jIxGH0C4eo/xaEQ/SUKJsH7mU=",
"requires": {
"chalk": "^3.0.0",
"progress": "^2.0.3"
},
"dependencies": {
"ansi-styles": {
"version": "4.2.1",
"resolved": "http://192.168.0.63:4873/ansi-styles/-/ansi-styles-4.2.1.tgz",
"integrity": "sha1-kK51xCTQCNJiTFvynq0xd+v881k=",
"requires": {
"@types/color-name": "^1.1.1",
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "3.0.0",
"resolved": "http://192.168.0.63:4873/chalk/-/chalk-3.0.0.tgz",
"integrity": "sha1-P3PCv1JlkfV0zEksUeJFY0n4ROQ=",
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "http://192.168.0.63:4873/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "http://192.168.0.63:4873/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI="
},
"has-flag": {
"version": "4.0.0",
"resolved": "http://192.168.0.63:4873/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s="
},
"supports-color": {
"version": "7.2.0",
"resolved": "http://192.168.0.63:4873/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=",
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"promise": { "promise": {
"version": "8.1.0", "version": "8.1.0",
"resolved": "https://registry.npm.taobao.org/promise/download/promise-8.1.0.tgz?cache=0&sync_timestamp=1583146725031&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fpromise%2Fdownload%2Fpromise-8.1.0.tgz", "resolved": "https://registry.npm.taobao.org/promise/download/promise-8.1.0.tgz?cache=0&sync_timestamp=1583146725031&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fpromise%2Fdownload%2Fpromise-8.1.0.tgz",
...@@ -10750,6 +10833,43 @@ ...@@ -10750,6 +10833,43 @@
"webpack-dev-server": "3.11.0", "webpack-dev-server": "3.11.0",
"webpack-manifest-plugin": "2.2.0", "webpack-manifest-plugin": "2.2.0",
"workbox-webpack-plugin": "4.3.1" "workbox-webpack-plugin": "4.3.1"
},
"dependencies": {
"@babel/core": {
"version": "7.9.0",
"resolved": "https://registry.npm.taobao.org/@babel/core/download/@babel/core-7.9.0.tgz?cache=0&sync_timestamp=1599146827519&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fcore%2Fdownload%2F%40babel%2Fcore-7.9.0.tgz",
"integrity": "sha1-rJd7U4t34TL/cG87ik260JwDxW4=",
"requires": {
"@babel/code-frame": "^7.8.3",
"@babel/generator": "^7.9.0",
"@babel/helper-module-transforms": "^7.9.0",
"@babel/helpers": "^7.9.0",
"@babel/parser": "^7.9.0",
"@babel/template": "^7.8.6",
"@babel/traverse": "^7.9.0",
"@babel/types": "^7.9.0",
"convert-source-map": "^1.7.0",
"debug": "^4.1.0",
"gensync": "^1.0.0-beta.1",
"json5": "^2.1.2",
"lodash": "^4.17.13",
"resolve": "^1.3.2",
"semver": "^5.4.1",
"source-map": "^0.5.0"
},
"dependencies": {
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npm.taobao.org/semver/download/semver-5.7.1.tgz?cache=0&sync_timestamp=1586886267748&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-5.7.1.tgz",
"integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc="
}
}
},
"source-map": {
"version": "0.5.7",
"resolved": "https://registry.npm.taobao.org/source-map/download/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w="
}
} }
}, },
"read-pkg": { "read-pkg": {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"@testing-library/jest-dom": "^4.2.4", "@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2", "@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2", "@testing-library/user-event": "^7.1.2",
"babel-loader": "^8.1.0", "progress-bar-webpack-plugin": "^2.1.0",
"react": "^16.13.1", "react": "^16.13.1",
"react-dom": "^16.13.1", "react-dom": "^16.13.1",
"react-scripts": "3.4.3" "react-scripts": "3.4.3"
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
"start": "react-scripts start", "start": "react-scripts start",
"build": "react-scripts build", "build": "react-scripts build",
"test": "react-scripts test", "test": "react-scripts test",
"eject": "react-scripts eject" "eject": "react-scripts eject",
"frame": "rm -r lib && webpack-cli"
}, },
"eslintConfig": { "eslintConfig": {
"extends": "react-app" "extends": "react-app"
...@@ -31,5 +32,11 @@ ...@@ -31,5 +32,11 @@
"last 1 firefox version", "last 1 firefox version",
"last 1 safari version" "last 1 safari version"
] ]
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.11.5",
"@babel/preset-react": "^7.10.4",
"babel-loader": "^8.1.0"
} }
} }
import React from 'react';
import { render } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
const { getByText } = render(<App />);
const linkElement = getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
import React, { useMemo, useEffect } from 'react'; import React, { useMemo, useEffect } from 'react';
import logo from './logo.svg'; import logo from './assets/logo.svg';
import './App.css' import './assets/App.css'
import { green, white } from 'color-name';
function Child(props){ function Child(props){
...@@ -15,7 +14,7 @@ function Child(props){ ...@@ -15,7 +14,7 @@ function Child(props){
},[message]) },[message])
// 内嵌样式写法,及图片调用 // 内嵌样式写法,及图片调用
return <div style={{width:"200px",height:"80px",color:"white",position:"relative"}}> return <div style={{width:"200px",height:"80px",color:"white",position:"relative"}}>
<img src={logo}/> <img src={logo} alt=""/>
<span id="txt">这是子组件,你好<em>{showMessage}</em></span> <span id="txt">这是子组件,你好<em>{showMessage}</em></span>
</div> </div>
} }
......
//react hook 基本用法 //react hook 基本用法
import React,{useState, useEffect, useMemo, useCallback} from 'react';//引用react import React,{useState, useEffect, useMemo, useCallback} from 'react';//引用react
import Child from './Child';//子组件引用 import Child from './Child';//子组件引用
import './App.css'; //样式的引用 import './assets/App.css'; //样式的引用
function App() { //在hook中模块是以函数的方式存在 function Hooky() { //在hook中模块是以函数的方式存在
const [count,setCount]=useState(0); //使用状态钩子 const [count,setCount]=useState(0); //使用状态钩子
const [user,setInfor]=useState({name:'tom'}); const [user,setInfor]=useState({name:'tom'});
...@@ -29,10 +29,10 @@ function App() { //在hook中模块是以函数的方式存在 ...@@ -29,10 +29,10 @@ function App() { //在hook中模块是以函数的方式存在
}, [count]); }, [count]);
// 比较 useMemo和useCallback的差异 // 比较 useMemo和useCallback的差异
useEffect(()=>{ // useEffect(()=>{
console.log(memo,'**') // console.log(memo,'**')
console.log(getCount,'..') // console.log(getCount,'..')
},[getCount]) // },[getCount])
return ( //所有页面结构用return 方式返回给使用的模块 return ( //所有页面结构用return 方式返回给使用的模块
...@@ -60,4 +60,4 @@ function App() { //在hook中模块是以函数的方式存在 ...@@ -60,4 +60,4 @@ function App() { //在hook中模块是以函数的方式存在
); );
} }
export default App; export default Hooky;
import React from 'react'; // import React from 'react';
import ReactDOM from 'react-dom'; // import ReactDOM from 'react-dom';
import './index.css'; // import './assets/index.css';
import App from './App'; // import Hooky from './Hooky';
import * as serviceWorker from './serviceWorker'; // import * as serviceWorker from './serviceWorker';
ReactDOM.render( // ReactDOM.render(
<React.StrictMode> // <React.StrictMode>
<App /> // <Hooky />
</React.StrictMode>, // </React.StrictMode>,
document.getElementById('root') // document.getElementById('root')
); // );
serviceWorker.unregister(); // serviceWorker.unregister();
import Hooky from './Hooky'
export {Hooky}
const path = require('path');
const webpack = require('webpack');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const keepStructure = require('./keepStructure');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const config = {
mode: 'production',
...keepStructure,
resolve: {
extensions: ['.js','.jsx', '.ts', '.json']
},
node: {
fs: 'empty'
},
optimization: {
minimizer: [
new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.optimize\.css$/g,
cssProcessor: require('cssnano'),
cssProcessorOptions: {
safe: true,
discardComments: {
removeAll: true
}
},
canPrint: true
}),
new TerserPlugin({
parallel: true,
terserOptions: {
beautify: false,
compress: true,
comments: false,
mangle: false,
toplevel: false,
keep_classnames: true,
keep_fnames: true,
}
})
],
},
//devtool: 'cheap-module-eval-source-map',
plugins: [
new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.optimize\.css$/g,
cssProcessor: require('cssnano'),
cssProcessorOptions: {
safe: true,
discardComments: {
removeAll: true
}
},
canPrint: true
}),
new ProgressBarPlugin({
complete: '.',
width: 50,
clear: false
}),
new webpack.optimize.SplitChunksPlugin({
chunks: "all",
minSize: 20000,
minChunks: 2,
name: "commons"
})
],
module: {
rules: [
{
test: /\.(js|jsx)$/,
use: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
},
{
test: /\.scss$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader",
options: {
sourceMap: true
}
}, {
loader: "sass-loader",
options: {
sourceMap: true
}
}]
},
// {
// test: /\.vue$/,
// loader: "vue-loader",
// options: {
// loaders: {
// scss: "vue-style-loader!css-loader!sass-loader",
// sass: "vue-style-loader!css-loader!sass-loader?indentedSyntax"
// }
// }
// },
// {
// test: /\.jsx?$/,
// exclude: [path.join(__dirname, 'node_modules')],
// include: [
// path.resolve(__dirname, 'src')
// ],
// use: [
// {
// loader: 'babel-loader',
// options: {
// presets: [['build', { env: 'react' }]]
// }
// }
// ]
// },
{
test: /\.(jpg|jpeg|png|gif|bmp|ttf|svg)$/,
//loaders: "file-loader",
loaders: "url-loader",
options: {
limit: 10000,
name: 'assets/images/[name].[ext]?[hash]',
esModule: false
}
}
]
},
externals: {
react: 'react',
redux: 'redux',
vue: 'vue'
}
}
module.exports = config;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment