Skip to content

Commit

Permalink
Do not load moment locales to reduce the bundle size
Browse files Browse the repository at this point in the history
As no locales are being used, is not necessary to load them

This and the moment.js usage can be removed if the creation
of the new .drawio file is managed with a modal instead
of adding a timestamp to the filename
  • Loading branch information
VirtualEvan committed Nov 18, 2020
1 parent 336fda5 commit a4a138f
Showing 1 changed file with 34 additions and 39 deletions.
73 changes: 34 additions & 39 deletions apps/draw-io/webpack.common.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,53 @@
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const webpack = require('webpack')

module.exports = {
plugins: [
new VueLoaderPlugin()
],
plugins: [new VueLoaderPlugin(), new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)],
entry: {
'draw-io': [
'core-js/modules/es6.promise',
'core-js/modules/es6.array.iterator',
'./src/app.js'
]
'draw-io': ['core-js/modules/es6.promise', 'core-js/modules/es6.array.iterator', './src/app.js']
},
output: {
publicPath: 'apps/draw-io/',
chunkFilename: '[name].draw-io.chunk.js',
filename: 'draw-io.bundle.js'
},
module: {
rules: [{
test: /\.js?$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
rootMode: 'upward'
}
}, {
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.jsx?$/,
include: /node_modules\/(?=(query-string|split-on-first|strict-uri-encode)\/).*/,
use: {
rules: [
{
test: /\.js?$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
targets: {
ie: '11'
rootMode: 'upward'
}
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.jsx?$/,
include: /node_modules\/(?=(query-string|split-on-first|strict-uri-encode)\/).*/,
use: {
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
targets: {
ie: '11'
}
}
}
]
]
]
}
}
},
{
test: /\.css$/,
use: ['vue-style-loader', 'css-loader']
}
},
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader'
]
}]
]
}
}

0 comments on commit a4a138f

Please sign in to comment.