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, {
|
2024-10-09 04:20:06 -04:00
|
|
|
output: {
|
|
|
|
workerPublicPath: '/__cypress/src/',
|
|
|
|
},
|
2022-06-08 03:39:09 -04:00
|
|
|
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
|
2024-09-15 18:01:29 -04:00
|
|
|
addWorker('pdfjs-dist', 'pdfjs-dist/build/pdf.worker.mjs')
|
2022-06-08 03:39:09 -04:00
|
|
|
|
|
|
|
return webpackConfig
|
|
|
|
}
|
|
|
|
|
|
|
|
export const webpackConfig = buildConfig()
|