Skip to content

Commit

Permalink
perf(options): minimize monaco-editor bundle size
Browse files Browse the repository at this point in the history
  • Loading branch information
xianshenglu committed Nov 22, 2020
1 parent 96f2ab4 commit 795d1fe
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 3 deletions.
22 changes: 21 additions & 1 deletion build/webpack.base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,27 @@ module.exports = {
template: path.resolve(__dirname, '../public/options.html'),
}),
new CleanObsoleteChunks(),
new MonacoWebpackPlugin(),
new MonacoWebpackPlugin({
languages: ['javascript', 'typescript'],
features: [
'!accessibilityHelp',
'!anchorSelect',
'!codeAction',
'!fontZoom',
'!gotoError',
'!gotoLine',
'!gotoSymbol',
'!iPadShowKeyboard',
'!quickCommand',
'!quickHelp',
'!quickOutline',
'!referenceSearch',
'!toggleTabFocusMode',
'!transpose',
'!unusualLineTerminators',
'!viewportSemanticTokens',
],
}),
new VueLoaderPlugin(),
new MiniCssExtractPlugin({
// determine the output path
Expand Down
170 changes: 170 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint --fix --ext .js,.vue src/",
"dev": "webpack --watch --config ./build/webpack.dev.conf.js",
"build": "webpack --config ./build/webpack.prod.conf.js"
"build": "webpack --config ./build/webpack.prod.conf.js",
"analyze": "webpack --config ./build/webpack.prod.conf.js --analyze"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -45,6 +46,7 @@
"vue-loader": "^15.9.5",
"vue-template-compiler": "^2.6.12",
"webpack": "^5.4.0",
"webpack-bundle-analyzer": "^4.1.0",
"webpack-clean-obsolete-chunks": "^0.4.0",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0"
Expand Down
2 changes: 1 addition & 1 deletion src/options/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</template>

<script>
import * as monaco from 'monaco-editor'
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api'
import { API_ORIGIN, API_FORMATTER_STR } from '../constants'
let editor = null
Expand Down

0 comments on commit 795d1fe

Please sign in to comment.