Skip to content

Commit

Permalink
optimize build size
Browse files Browse the repository at this point in the history
  • Loading branch information
qishibo committed Nov 26, 2021
1 parent 742729d commit b44740c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build/webpack.dev.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
},
plugins: [
new VueLoaderPlugin(),
new MonacoWebpackPlugin(),
new MonacoWebpackPlugin({languages: ['json'], features: []}),
// new webpack.DefinePlugin({
// 'process.env': require('../config/dev.env')
// }),
Expand Down
24 changes: 11 additions & 13 deletions build/webpack.prod.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const UglifyJsPlugin = require('uglifyjs-webpack-plugin')

const VueLoaderPlugin = require('vue-loader/lib/plugin');
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin

const env = require('../config/prod.env')

Expand All @@ -36,8 +37,10 @@ const webpackConfig = merge(baseWebpackConfig, {
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
},
plugins: [
// show bundle analysis if need
// new BundleAnalyzerPlugin(),
new VueLoaderPlugin(),
new MonacoWebpackPlugin({languages: ['json']}),
new MonacoWebpackPlugin({languages: ['json'], features: []}),
// http://vuejs.github.io/vue-loader/en/workflow/production.html
// new webpack.DefinePlugin({
// 'process.env': env
Expand Down Expand Up @@ -154,18 +157,13 @@ const webpackConfig = merge(baseWebpackConfig, {
],
splitChunks: {
chunks: 'all',
cacheGroups: {
// commons: {
// name: 'commons',
// chunks: 'initial',
// minChunks: 2
// },
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all',
},
}
// cacheGroups: {
// commons: {
// test: /[\\/]node_modules[\\/]/,
// name: 'vendors',
// chunks: 'all',
// },
// }
}
},
})
Expand Down
4 changes: 2 additions & 2 deletions config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ module.exports = {
* Source Maps
*/

productionSourceMap: true,
productionSourceMap: false,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',
// devtool: '#source-map',

// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
Expand Down
3 changes: 2 additions & 1 deletion src/components/JsonEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
</template>

<script type="text/javascript">
import * as monaco from 'monaco-editor';
// import * as monaco from 'monaco-editor';
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';

export default {
data() {
Expand Down

0 comments on commit b44740c

Please sign in to comment.