mirror of
https://github.com/pdfme/pdfme.git
synced 2026-06-03 20:06:26 -04:00
55 lines
1.1 KiB
JavaScript
55 lines
1.1 KiB
JavaScript
const path = require('path');
|
|
const webpack = require('webpack');
|
|
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
const pkg = require('./package.json');
|
|
|
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
|
|
const BANNER = [
|
|
'@name ' + pkg.name,
|
|
'@version ' + pkg.version + ' | ' + new Date().toDateString(),
|
|
'@author ' + pkg.author,
|
|
'@license ' + pkg.license,
|
|
].join('\n');
|
|
|
|
const config = {
|
|
optimization: { minimize: isProduction },
|
|
resolve: {
|
|
extensions: ['.ts', '.js'],
|
|
},
|
|
plugins: [
|
|
// new BundleAnalyzerPlugin(),
|
|
new webpack.BannerPlugin({
|
|
banner: BANNER,
|
|
entryOnly: true,
|
|
}),
|
|
],
|
|
devtool: 'source-map',
|
|
devServer: {
|
|
historyApiFallback: false,
|
|
host: '0.0.0.0',
|
|
},
|
|
entry: './src/index.ts',
|
|
output: {
|
|
path: path.resolve(__dirname, 'dist'),
|
|
filename: 'index.js',
|
|
globalObject: 'this',
|
|
library: {
|
|
type: 'umd',
|
|
},
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.ts$/,
|
|
use: 'ts-loader',
|
|
},
|
|
{
|
|
test: /\.(ttf)$/i,
|
|
use: ['url-loader'],
|
|
},
|
|
],
|
|
},
|
|
};
|
|
module.exports = config;
|