Browse Source

chore: update webpack config

pull/2682/head 2.0.0-beta.2
tangjinzhou 4 years ago
parent
commit
2891168a0f
  1. 18
      antd-tools/getBabelCommonConfig.js
  2. 14
      antd-tools/getWebpackConfig.js
  3. 3
      package.json
  4. 3
      webpack.build.conf.js

18
antd-tools/getBabelCommonConfig.js

@ -3,14 +3,20 @@
module.exports = function(modules) {
const plugins = [
require.resolve('@ant-design-vue/babel-plugin-jsx'),
require.resolve('babel-plugin-inline-import-data-uri'),
require.resolve('@babel/plugin-transform-member-expression-literals'),
require.resolve('@babel/plugin-transform-property-literals'),
require.resolve('@babel/plugin-proposal-export-default-from'),
require.resolve('@babel/plugin-proposal-optional-chaining'),
require.resolve('@babel/plugin-transform-object-assign'),
require.resolve('@babel/plugin-transform-template-literals'),
require.resolve('@babel/plugin-proposal-object-rest-spread'),
require.resolve('@babel/plugin-proposal-export-default-from'),
require.resolve('@babel/plugin-proposal-class-properties'),
require.resolve('@babel/plugin-syntax-dynamic-import'),
// require.resolve('babel-plugin-inline-import-data-uri'),
// require.resolve('@babel/plugin-transform-member-expression-literals'),
// require.resolve('@babel/plugin-transform-property-literals'),
// require.resolve('@babel/plugin-proposal-export-default-from'),
// require.resolve('@babel/plugin-transform-object-assign'),
// require.resolve('@babel/plugin-transform-template-literals'),
// require.resolve('@babel/plugin-proposal-object-rest-spread'),
// require.resolve('@babel/plugin-proposal-class-properties'),
];
plugins.push([
require.resolve('@babel/plugin-transform-runtime'),
@ -29,7 +35,7 @@ module.exports = function(modules) {
'last 2 versions',
'Firefox ESR',
'> 1%',
'ie >= 9',
'ie >= 11',
'iOS >= 8',
'Android >= 4',
],

14
antd-tools/getWebpackConfig.js

@ -8,6 +8,7 @@ const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const postcssConfig = require('./postcssConfig');
const CleanUpStatsPlugin = require('./utils/CleanUpStatsPlugin');
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const distFileBaseName = 'antd';
@ -25,13 +26,11 @@ function getWebpackConfig(modules) {
const pkg = require(path.join(process.cwd(), 'package.json'));
const babelConfig = require('./getBabelCommonConfig')(modules || false);
const pluginImportOptions = [
{
style: true,
libraryName: distFileBaseName,
libraryDirectory: 'components',
},
];
const pluginImportOptions = {
style: true,
libraryName: distFileBaseName,
libraryDirectory: 'components',
};
babelConfig.plugins.push([require.resolve('babel-plugin-import'), pluginImportOptions]);
if (modules === false) {
@ -157,6 +156,7 @@ function getWebpackConfig(modules) {
},
plugins: [
// new BundleAnalyzerPlugin(),
new CaseSensitivePathsPlugin(),
new webpack.BannerPlugin(`
${pkg.name} v${pkg.version}

3
package.json

@ -1,6 +1,6 @@
{
"name": "ant-design-vue",
"version": "1.6.4",
"version": "2.0.0-beta.2",
"title": "Ant Design Vue",
"description": "An enterprise-class UI design language and Vue-based implementation",
"keywords": [
@ -176,6 +176,7 @@
"vue-virtual-scroller": "^1.0.0",
"vuex": "^4.0.0-beta.2",
"webpack": "^4.28.4",
"webpack-bundle-analyzer": "^3.8.0",
"webpack-cli": "^3.2.1",
"webpack-dev-server": "^3.1.14",
"webpack-merge": "^4.1.1",

3
webpack.build.conf.js

@ -1,7 +1,6 @@
// This config is for building dist files
const webpack = require('webpack');
const getWebpackConfig = require('./antd-tools/getWebpackConfig');
const { webpack } = getWebpackConfig;
// noParse still leave `require('./locale' + name)` in dist files
// ignore is better
// http://stackoverflow.com/q/25384360

Loading…
Cancel
Save