2022-06-08 03:39:09 -04:00
|
|
|
import { merge } from 'webpack-merge'
|
|
|
|
import path from 'path'
|
|
|
|
import webpack from 'webpack'
|
|
|
|
import HtmlWebpackPlugin from 'html-webpack-plugin'
|
|
|
|
import devConfig from '../../webpack.config.dev'
|
|
|
|
|
|
|
|
const buildConfig = () => {
|
|
|
|
const webpackConfig = merge(devConfig, {
|
|
|
|
devServer: {
|
|
|
|
static: path.join(__dirname, '../../public'),
|
|
|
|
port: 3200,
|
|
|
|
},
|
|
|
|
stats: 'none',
|
|
|
|
plugins: [
|
|
|
|
new webpack.EnvironmentPlugin({
|
|
|
|
CYPRESS: true,
|
|
|
|
}),
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
template: path.resolve('./component-index.html'),
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
} as any)
|
|
|
|
|
|
|
|
delete webpackConfig.devServer.client
|
|
|
|
|
|
|
|
webpackConfig.entry = {}
|
|
|
|
const addWorker = (name: string, importPath: string) => {
|
|
|
|
webpackConfig.entry[name] = require.resolve(importPath)
|
|
|
|
}
|
|
|
|
|
|
|
|
// add entrypoint under '/' for latex-linter worker
|
|
|
|
addWorker(
|
|
|
|
'latex-linter-worker',
|
2023-09-28 11:32:24 -04:00
|
|
|
'../../frontend/js/features/source-editor/languages/latex/linter/latex-linter.worker'
|
2022-06-08 03:39:09 -04:00
|
|
|
)
|
|
|
|
|
2024-10-02 04:25:02 -04:00
|
|
|
// add entrypoint under '/' for hunspell worker
|
|
|
|
addWorker(
|
|
|
|
'hunspell-worker',
|
|
|
|
'../../frontend/js/features/source-editor/hunspell/hunspell.worker'
|
|
|
|
)
|
|
|
|
|
2022-06-08 03:39:09 -04:00
|
|
|
// add entrypoints under '/' for pdfjs workers
|
2023-11-14 04:51:30 -05:00
|
|
|
addWorker('pdfjs-dist213', 'pdfjs-dist213/legacy/build/pdf.worker.js')
|
|
|
|
addWorker('pdfjs-dist401', 'pdfjs-dist401/legacy/build/pdf.worker.mjs')
|
2022-06-08 03:39:09 -04:00
|
|
|
|
|
|
|
return webpackConfig
|
|
|
|
}
|
|
|
|
|
|
|
|
export const webpackConfig = buildConfig()
|