-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
es and umd modules and expose getter for default labels
- Loading branch information
1 parent
6051f02
commit 4ef6149
Showing
13 changed files
with
153 additions
and
31 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
const path = require('path') | ||
const webpack = require('webpack') | ||
const packageJson = require('../package.json') | ||
const TerserPlugin = require('terser-webpack-plugin') | ||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer') | ||
|
||
// analyze the bundle size | ||
module.exports = { | ||
mode: 'production', | ||
entry: ['./src/index.js'], | ||
output: { | ||
filename: '[name].min.js', // Dynamic naming for entry points | ||
chunkFilename: '[name].[contenthash].js', // Dynamic naming for split chunks | ||
path: path.resolve(__dirname, '../build'), | ||
library: 'eurostatmap', | ||
libraryTarget: 'umd', | ||
publicPath: '/build/', | ||
}, | ||
devtool: false, | ||
plugins: [ | ||
new BundleAnalyzerPlugin(), | ||
new webpack.BannerPlugin({ | ||
banner: `/*! eurostat-map v${packageJson.version} | ${new Date().getFullYear()} Eurostat | EUPL License. See https://github.com/eurostat/eurostat-map/blob/master/LICENSE */`, | ||
raw: false, // Adds the comment as plain text | ||
}), | ||
], | ||
optimization: { | ||
minimize: true, | ||
concatenateModules: false, // Disable scope hoisting for better analysis | ||
minimizer: [ | ||
new TerserPlugin({ | ||
extractComments: false, // Disable extracting comments to a separate file | ||
}), | ||
], | ||
splitChunks: { | ||
chunks: 'all', // Split vendor and app code | ||
}, | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: 'babel-loader', | ||
options: { | ||
presets: ['@babel/preset-env'], | ||
babelrc: false, | ||
cacheDirectory: true, | ||
sourceMaps: false, | ||
}, | ||
}, | ||
}, | ||
|
||
{ | ||
test: /\.css$/i, | ||
use: ['style-loader', 'css-loader'], // For CSS files | ||
}, | ||
], | ||
}, | ||
watch: false, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const path = require('path') | ||
|
||
module.exports = { | ||
mode: 'production', | ||
entry: './src/index.js', | ||
output: { | ||
filename: 'index.js', | ||
path: path.resolve(__dirname, '../build/es'), | ||
libraryTarget: 'module', // Output as ES module | ||
}, | ||
experiments: { | ||
outputModule: true, // Enable ESM output | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: 'babel-loader', | ||
options: { | ||
presets: [['@babel/preset-env', { modules: false }]], // Keep ES Modules | ||
}, | ||
}, | ||
}, | ||
{ | ||
test: /\.css$/i, | ||
use: ['style-loader', 'css-loader'], // For CSS files | ||
}, | ||
], | ||
}, | ||
} |
File renamed without changes.