diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 8aa26455..00000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) [year] [fullname] - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/add.txt b/add.txt index 14b6fefe..8bd5bb1d 100644 --- a/add.txt +++ b/add.txt @@ -26,11 +26,9 @@ MainContentContainer -TODO - 待同步 +TODO + 待同步 1、timer图标样式更换 index.html WebSSHTimer.css - WebSSHTimer.js - - + WebSSHTimer.js \ No newline at end of file diff --git a/config/env.js b/config/env.js index ae1edea6..8e68efe0 100644 --- a/config/env.js +++ b/config/env.js @@ -76,7 +76,7 @@ function getClientEnvironment(publicUrl) { // For example, . // This should only be used as an escape hatch. Normally you would put // images into the `src` and `import` them in code to get their paths. - PUBLIC_URL: '/react/build/.', + PUBLIC_URL: publicUrl, } ); // Stringify all values so we can feed into Webpack DefinePlugin diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js index 85aa92b9..17446b8c 100644 --- a/config/webpack.config.dev.js +++ b/config/webpack.config.dev.js @@ -7,32 +7,41 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); -const eslintFormatter = require('react-dev-utils/eslintFormatter'); const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); -// const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); +const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); const getClientEnvironment = require('./env'); const paths = require('./paths'); -// Webpack uses `publicPath` to determine where the app is being served from. -// In development, we always serve from the root. This makes config easier. const publicPath = '/'; -// `publicUrl` is just like `publicPath`, but we will provide it to our app -// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript. -// Omit trailing slash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz. -const publicUrl = ''; -// Get environment variables to inject into our app. -const env = getClientEnvironment(publicUrl); +const env = getClientEnvironment('/'); -// This is the development configuration. -// It is focused on developer experience and fast rebuilds. -// The production configuration is different and lives in a separate file. -// 测试用的 module.exports = { - // You may want 'eval' instead if you prefer to see the compiled output in DevTools. - // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s - //devtool: "cheap-module-eval-source-map", + optimization: { + splitChunks: { + chunks: 'async', + // 大于30KB才单独分离成chunk + minSize: 30000, + maxAsyncRequests: 5, + maxInitialRequests: 3, + name: true, + cacheGroups: { + default: { + priority: -20, + reuseExistingChunk: true, + }, + vendors: { + name: 'vendors', + test: /[\\/]node_modules[\\/]/, + priority: -10, + chunks: "all" + } + } + }, + runtimeChunk: true + }, + mode: 'development', // 开启调试 - devtool: "source-map", // 开启调试 + devtool: "source-map", // 开启调试 // These are the "entry points" to our application. // This means they will be the "root" imports that are included in JS bundle. // The first two entry points enable "hot" CSS and auto-refreshes for JS. @@ -59,6 +68,7 @@ module.exports = { output: { // Add /* filename */ comments to generated require()s in the output. pathinfo: true, + globalObject: 'this', // This does not produce a real file. It's just the virtual path that is // served by WebpackDevServer in development. This is the JS bundle // containing code from all our entry points, and the Webpack runtime. @@ -66,7 +76,7 @@ module.exports = { // There are also additional JS chunk files if you use code splitting. chunkFilename: 'static/js/[name].chunk.js', // This is the URL that app is served from. We use "/" in development. - publicPath: publicPath, + publicPath, // Point sourcemap entries to original disk location (format as URL on Windows) devtoolModuleFilenameTemplate: info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/'), @@ -101,36 +111,11 @@ module.exports = { // please link the files into your node_modules/ and let module-resolution kick in. // Make sure your source files are compiled, as they will not be processed in any way. new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]), - // MonacoEditor - // https://github.com/Microsoft/monaco-editor/blob/master/docs/integrate-esm.md - // https://github.com/Microsoft/monaco-editor-webpack-plugin/issues/56 - // new MonacoWebpackPlugin(), ], }, module: { strictExportPresence: true, rules: [ - // TODO: Disable require.ensure as it's not a standard language feature. - // We are waiting for https://github.com/facebookincubator/create-react-app/issues/2176. - // { parser: { requireEnsure: false } }, - - // First, run the linter. - // It's important to do this before Babel processes the JS. - // { - // test: /\.(js|jsx|mjs)$/, - // enforce: 'pre', - // use: [ - // { - // options: { - // formatter: eslintFormatter, - // eslintPath: require.resolve('eslint'), - // - // }, - // loader: require.resolve('eslint-loader'), - // }, - // ], - // include: paths.appSrc, - // }, { // "oneOf" will traverse all following loaders until one will // match the requirements. When no loader matches it will fall @@ -151,13 +136,20 @@ module.exports = { { test: /\.(js|jsx|mjs)$/, include: paths.appSrc, + exclude: /node_modules/, loader: require.resolve('babel-loader'), options: { - - // This is a feature of `babel-loader` for webpack (not Babel itself). + // This is a feature of `babel-loader` for webpack (not Babel itself). // It enables caching results in ./node_modules/.cache/babel-loader/ // directory for faster rebuilds. cacheDirectory: true, + "plugins": [ + ["import", { + "libraryName": "antd", + "libraryDirectory": "es", + "style": "css" + }] + ] }, }, // "postcss" loader applies autoprefixer to our CSS. @@ -200,7 +192,7 @@ module.exports = { { test: /\.scss$/, use: [ - require.resolve("style-loader"), + require.resolve('style-loader'), { loader: require.resolve("css-loader"), options: { @@ -239,12 +231,13 @@ module.exports = { // The public URL is available as %PUBLIC_URL% in index.html, e.g.: // // In development, this will be an empty string. - new InterpolateHtmlPlugin(env.raw), // Generates an `index.html` file with the '; + }) + .replace(/