You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.1 KiB
49 lines
1.1 KiB
const path = require('path');
|
|
const webpack = require('webpack');
|
|
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
|
const common = require('./webpack.config.common');
|
|
|
|
const genConfig = ({
|
|
entry, filename, library, libraryTarget,
|
|
}) => ({
|
|
...common,
|
|
mode: 'development',
|
|
devtool: 'source-map',
|
|
entry,
|
|
output: {
|
|
filename,
|
|
library,
|
|
libraryTarget,
|
|
},
|
|
plugins: [
|
|
new webpack.ProvidePlugin({
|
|
Buffer: ['buffer', 'Buffer'],
|
|
}),
|
|
new webpack.DefinePlugin({
|
|
'process.env': {
|
|
TESS_ENV: JSON.stringify('development'),
|
|
},
|
|
}),
|
|
new BundleAnalyzerPlugin({
|
|
analyzerMode: 'disable',
|
|
statsFilename: `${filename.split('.')[0]}-stats.json`,
|
|
generateStatsFile: true
|
|
}),
|
|
],
|
|
devServer: {
|
|
allowedHosts: ['localhost', '.gitpod.io'],
|
|
},
|
|
});
|
|
|
|
module.exports = [
|
|
genConfig({
|
|
entry: path.resolve(__dirname, '..', 'src', 'index.js'),
|
|
filename: 'tesseract.dev.js',
|
|
library: 'Tesseract',
|
|
libraryTarget: 'umd',
|
|
}),
|
|
genConfig({
|
|
entry: path.resolve(__dirname, '..', 'src', 'worker-script', 'browser', 'index.js'),
|
|
filename: 'worker.dev.js',
|
|
}),
|
|
];
|
|
|