mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
5e9af2c15c
GitOrigin-RevId: f373f4215e5f25d14256008cf5f6582eb3124431
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
module.exports = (on, config) => {
|
|
if (config.testingType === 'component') {
|
|
const { startDevServer } = require('@cypress/webpack-dev-server')
|
|
const { merge } = require('webpack-merge')
|
|
const path = require('path')
|
|
const webpack = require('webpack')
|
|
const devConfig = require('../../webpack.config.dev')
|
|
|
|
const webpackConfig = merge(devConfig, {
|
|
devServer: {
|
|
static: path.join(__dirname, '../../public'),
|
|
},
|
|
stats: 'none',
|
|
plugins: [
|
|
new webpack.EnvironmentPlugin({
|
|
CYPRESS: true,
|
|
}),
|
|
],
|
|
})
|
|
|
|
delete webpackConfig.devServer.client
|
|
|
|
webpackConfig.entry = {}
|
|
const addWorker = (name, importPath) => {
|
|
webpackConfig.entry[name] = require.resolve(importPath)
|
|
}
|
|
|
|
// add entrypoint under '/' for latex-linter worker
|
|
addWorker(
|
|
'latex-linter-worker',
|
|
'../../modules/source-editor/frontend/js/languages/latex/linter/latex-linter.worker.js'
|
|
)
|
|
|
|
// add entrypoints under '/' for pdfjs workers
|
|
const pdfjsVersions = ['pdfjs-dist210', 'pdfjs-dist213']
|
|
for (const name of pdfjsVersions) {
|
|
addWorker(name, `${name}/legacy/build/pdf.worker.js`)
|
|
}
|
|
|
|
on('dev-server:start', options => {
|
|
return startDevServer({ options, webpackConfig })
|
|
})
|
|
}
|
|
}
|