summaryrefslogtreecommitdiffstats
path: root/webpack.config.js
diff options
context:
space:
mode:
Diffstat (limited to 'webpack.config.js')
-rw-r--r--webpack.config.js36
1 files changed, 35 insertions, 1 deletions
diff --git a/webpack.config.js b/webpack.config.js
index e87dd770cb..d6a632ad1f 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -2,6 +2,7 @@ const cssnano = require('cssnano');
const fastGlob = require('fast-glob');
const FixStyleOnlyEntriesPlugin = require('webpack-fix-style-only-entries');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
+const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const PostCSSPresetEnv = require('postcss-preset-env');
const PostCSSSafeParser = require('postcss-safe-parser');
@@ -76,6 +77,14 @@ module.exports = {
splitChunks: {
chunks: 'async',
name: (_, chunks) => chunks.map((item) => item.name).join('-'),
+ cacheGroups: {
+ // this bundles all monaco's languages into one file instead of emitting 1-65.js files
+ monaco: {
+ test: /monaco-editor/,
+ name: 'monaco',
+ chunks: 'async'
+ }
+ }
}
},
module: {
@@ -91,6 +100,7 @@ module.exports = {
},
{
test: /\.worker\.js$/,
+ exclude: /monaco/,
use: [
{
loader: 'worker-loader',
@@ -149,7 +159,10 @@ module.exports = {
loader: 'css-loader',
options: {
importLoaders: 2,
- url: false,
+ url: (_url, resourcePath) => {
+ // only resolve URLs for dependencies
+ return resourcePath.includes('node_modules');
+ },
}
},
{
@@ -187,6 +200,19 @@ module.exports = {
},
],
},
+ {
+ test: /\.(ttf|woff2?)$/,
+ use: [
+ {
+ loader: 'file-loader',
+ options: {
+ name: '[name].[ext]',
+ outputPath: 'fonts/',
+ publicPath: (url) => `../fonts/${url}`, // seems required for monaco's font
+ },
+ },
+ ],
+ },
],
},
plugins: [
@@ -209,9 +235,14 @@ module.exports = {
new SpriteLoaderPlugin({
plainSprite: true,
}),
+ new MonacoWebpackPlugin({
+ filename: 'js/monaco-[name].worker.js',
+ }),
],
performance: {
hints: false,
+ maxEntrypointSize: Infinity,
+ maxAssetSize: Infinity,
},
resolve: {
symlinks: false,
@@ -224,4 +255,7 @@ module.exports = {
'node_modules/**',
],
},
+ stats: {
+ children: false,
+ },
};