From 65ca9675b865c322fc3b5736399052c76e4eaa62 Mon Sep 17 00:00:00 2001 From: 07akioni <07akioni2@gmail.com> Date: Tue, 3 Nov 2020 15:17:33 +0800 Subject: [PATCH] chore: remove webpack configs --- build/config.js | 73 ----------------------------------- build/webpack.demo.js | 59 ---------------------------- build/webpack.dev.js | 56 --------------------------- build/webpack.doc.js | 52 ------------------------- build/webpack.test.js | 71 ---------------------------------- build/webpack.tusimple-dev.js | 5 --- build/webpack.tusimple-doc.js | 5 --- 7 files changed, 321 deletions(-) delete mode 100644 build/config.js delete mode 100644 build/webpack.demo.js delete mode 100644 build/webpack.dev.js delete mode 100644 build/webpack.doc.js delete mode 100644 build/webpack.test.js delete mode 100644 build/webpack.tusimple-dev.js delete mode 100644 build/webpack.tusimple-doc.js diff --git a/build/config.js b/build/config.js deleted file mode 100644 index fa212e838..000000000 --- a/build/config.js +++ /dev/null @@ -1,73 +0,0 @@ -const path = require('path') -const MiniCssExtractPlugin = require('mini-css-extract-plugin') -const { DefinePlugin } = require('webpack') - -exports.alias = { - 'naive-ui/lib/icons': path.resolve(__dirname, '../src/_icons'), - 'naive-ui': path.resolve(__dirname, '../src/index.js'), - src: path.resolve(__dirname, '../src') -} - -exports.resolve = { - extensions: ['.js', '.vue', '.json', '.entry', '.demo-entry.md', '.demo.md', '.md'], - alias: exports.alias, - modules: ['node_modules'] -} - -exports.docLoaders = (env) => [ - { - test: /index\.entry$/, - loader: ['vue-loader', path.resolve(__dirname, '../demo/loaders/NaiveUIDocEntryLoader.js')] - }, - { - test: /\.demo\.md$/, - loader: ['vue-loader', path.resolve(__dirname, '../demo/loaders/NaiveUIDemoLoader.js')] - }, - { - test: /\.demo-entry\.md$/, - loader: ['vue-loader', path.resolve(__dirname, '../demo/loaders/NaiveUIDocLoader.js')] - }, - // TODO: update loader test - { - test: { - test: /\.md$/, - exclude: [/\.demo-entry\.md$/, /\.demo\.md$/] - }, - loader: ['vue-loader', path.resolve(__dirname, '../demo/loaders/NaiveUIMdLoader.js')] - }, - { - test: /\.vue$/, - loader: 'vue-loader', - options: { - compilerOptions: { - whitespace: 'condense' - } - } - }, - { - test: /\.(js|jsx)$/, - exclude: [/node_modules/], - loader: 'babel-loader', - options: { - plugins: ['@babel/plugin-syntax-dynamic-import'] - } - }, - { - test: /\.(scss|css)$/, - use: [...(env === 'production' ? [MiniCssExtractPlugin.loader] : []), ...(env === 'production' ? [] : ['style-loader']), 'css-loader', 'postcss-loader', 'sass-loader'] - }, - { - test: /\.(svg|otf|ttf|woff2?|eot|gif|png|jpe?g)(\?\S*)?$/, - loader: 'url-loader', - query: { - limit: 10000, - name: path.posix.join('static', '[name].[hash:7].[ext]') - } - } -] - -exports.plugins = [ - new DefinePlugin({ - __DEV__: JSON.stringify(process.env.NODE_ENV === 'development') - }) -] diff --git a/build/webpack.demo.js b/build/webpack.demo.js deleted file mode 100644 index c9cafafc8..000000000 --- a/build/webpack.demo.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Webpack config to see if css file works on demo page - */ -const path = require('path') -const webpack = require('webpack') -const config = require('./config') -const HtmlWebpackPlugin = require('html-webpack-plugin') -const VueLoaderPlugin = require('vue-loader/lib/plugin') -const MiniCssExtractPlugin = require('mini-css-extract-plugin') - -const webpackConfig = { - mode: 'production', - entry: './demo/deployment-index.js', - output: { - path: path.resolve(process.cwd()), - publicPath: '/', - filename: '[name].[hash:7].js', - chunkFilename: '[name].[hash:7].js' - }, - resolve: config.resolve, - devServer: { - host: '0.0.0.0', - port: 8087, - publicPath: '/', - hot: false, - historyApiFallback: true - }, - performance: { - hints: false - }, - stats: { - children: false - }, - module: { - rules: config.docLoaders('production') - }, - plugins: [ - new HtmlWebpackPlugin({ - template: './demo/index.tpl', - favicon: './demo/assets/images/naivelogo.svg' - }), - new VueLoaderPlugin(), - new webpack.LoaderOptionsPlugin({ - vue: { - compilerOptions: { - preserveWhitespace: false - } - } - }), - new MiniCssExtractPlugin({ - filename: '[name].css', - chunkFilename: '[id].css', - ignoreOrder: false - }), - ...config.plugins - ] -} - -module.exports = webpackConfig diff --git a/build/webpack.dev.js b/build/webpack.dev.js deleted file mode 100644 index be1c90b46..000000000 --- a/build/webpack.dev.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Webpack config under development - */ -const path = require('path') -const webpack = require('webpack') -const config = require('./config') -const HtmlWebpackPlugin = require('html-webpack-plugin') -const { VueLoaderPlugin } = require('vue-loader') -const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin') - -const webpackConfig = { - mode: 'development', - entry: './demo/index.dev', - output: { - path: path.resolve(process.cwd()), - publicPath: '/', - filename: '[name].[hash:7].js', - chunkFilename: '[name].[hash:7].js' - }, - resolve: config.resolve, - devServer: { - host: '0.0.0.0', - port: 14138, - publicPath: '/', - hot: true, - historyApiFallback: true - }, - performance: { - hints: false - }, - stats: { - children: false - }, - module: { - rules: config.docLoaders() - }, - plugins: [ - new CaseSensitivePathsPlugin(), - new webpack.HotModuleReplacementPlugin(), - new HtmlWebpackPlugin({ - template: './demo/index.tpl', - favicon: './demo/assets/images/naivelogo.svg' - }), - new VueLoaderPlugin(), - new webpack.LoaderOptionsPlugin({ - vue: { - compilerOptions: { - preserveWhitespace: false - } - } - }), - ...config.plugins - ] -} - -module.exports = webpackConfig diff --git a/build/webpack.doc.js b/build/webpack.doc.js deleted file mode 100644 index c8ae26c2a..000000000 --- a/build/webpack.doc.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Webpack config to pack documentation page - */ -const path = require('path') -const webpack = require('webpack') -const config = require('./config') -const HtmlWebpackPlugin = require('html-webpack-plugin') -const VueLoaderPlugin = require('vue-loader/lib/plugin') -const MiniCssExtractPlugin = require('mini-css-extract-plugin') - -const webpackConfig = { - mode: 'production', - entry: './demo/deployment-index.js', - output: { - path: path.resolve(__dirname, '..', 'build-doc', 'dist'), - publicPath: '/', - filename: '[name].[hash:7].js', - chunkFilename: '[name].[hash:7].js' - }, - resolve: config.resolve, - performance: { - hints: false - }, - stats: { - children: false - }, - module: { - rules: config.docLoaders('production') - }, - plugins: [ - new HtmlWebpackPlugin({ - template: './demo/index.tpl', - favicon: './demo/assets/images/naivelogo.svg' - }), - new VueLoaderPlugin(), - new webpack.LoaderOptionsPlugin({ - vue: { - compilerOptions: { - preserveWhitespace: false - } - } - }), - new MiniCssExtractPlugin({ - filename: '[name].css', - chunkFilename: '[id].css', - ignoreOrder: false - }), - ...config.plugins - ] -} - -module.exports = webpackConfig diff --git a/build/webpack.test.js b/build/webpack.test.js deleted file mode 100644 index 7b5e3a34b..000000000 --- a/build/webpack.test.js +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Webpack config for unit test - */ -const path = require('path') -const VueLoaderPlugin = require('vue-loader/lib/plugin') -const config = require('./config') -const env = process.env.NODE_ENV - -const webpackConfig = { - mode: env === 'production' ? 'production' : 'development', - entry: { - app: ['./src/index.js'] - }, - output: { - path: path.resolve(process.cwd(), './dist'), - publicPath: '/dist/', - filename: '[name].js', - chunkFilename: '[id].js' - }, - resolve: { - extensions: ['.js', '.vue', '.json'], - alias: config.alias, - modules: ['node_modules'] - }, - module: { - rules: [ - { - test: /\.(jsx?|babel|es6)$/, - include: process.cwd(), - exclude: /node_modules|utils\/popper\.js|utils\/date\.js/, - loader: 'babel-loader' - }, - { - test: /\.vue$/, - loader: 'vue-loader', - options: { - compilerOptions: { - preserveWhitespace: false - } - } - }, - { - test: /\.(scss|css)$/, - use: [ - 'style-loader', - 'css-loader', - 'sass-loader' - ] - }, - { - test: /\.(svg|otf|ttf|woff2?|eot|gif|png|jpe?g)(\?\S*)?$/, - loader: 'url-loader', - query: { - limit: 10000, - name: path.posix.join('static', '[name].[hash:7].[ext]') - } - } - ] - }, - plugins: [ - new VueLoaderPlugin() - ] -} - -// if (!process.env.CI_ENV) { -// webpackConfig.plugins.push( -// new ProgressBarPlugin() -// ); -// } - -module.exports = webpackConfig diff --git a/build/webpack.tusimple-dev.js b/build/webpack.tusimple-dev.js deleted file mode 100644 index bb340da59..000000000 --- a/build/webpack.tusimple-dev.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = Object.assign( - {}, - require('./webpack.dev'), - { entry: './demo/tusimple-index.dev.js' } -) diff --git a/build/webpack.tusimple-doc.js b/build/webpack.tusimple-doc.js deleted file mode 100644 index 0ba10e193..000000000 --- a/build/webpack.tusimple-doc.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = Object.assign( - {}, - require('./webpack.doc'), - { entry: './demo/tusimple-deployment-index.js' } -)