Skip to content

Commit

Permalink
chore: update webpack config
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjinzhou committed Aug 14, 2020
1 parent be7de76 commit 2891168
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
18 changes: 12 additions & 6 deletions antd-tools/getBabelCommonConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -29,7 +35,7 @@ module.exports = function(modules) {
'last 2 versions',
'Firefox ESR',
'> 1%',
'ie >= 9',
'ie >= 11',
'iOS >= 8',
'Android >= 4',
],
Expand Down
14 changes: 7 additions & 7 deletions antd-tools/getWebpackConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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) {
Expand Down Expand Up @@ -157,6 +156,7 @@ function getWebpackConfig(modules) {
},

plugins: [
// new BundleAnalyzerPlugin(),
new CaseSensitivePathsPlugin(),
new webpack.BannerPlugin(`
${pkg.name} v${pkg.version}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions webpack.build.conf.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 2891168

Please sign in to comment.