2018-01-12 06:41:02 -05:00
|
|
|
const path = require('path')
|
2021-09-08 05:26:18 -04:00
|
|
|
const glob = require('glob')
|
2019-10-16 06:10:54 -04:00
|
|
|
const webpack = require('webpack')
|
|
|
|
const CopyPlugin = require('copy-webpack-plugin')
|
2021-09-08 04:24:14 -04:00
|
|
|
const WebpackAssetsManifest = require('webpack-assets-manifest')
|
2019-11-28 05:20:22 -05:00
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
2022-06-23 04:19:07 -04:00
|
|
|
const {
|
|
|
|
LezerGrammarCompilerPlugin,
|
|
|
|
} = require('./webpack-plugins/lezer-grammar-compiler')
|
2019-10-16 06:10:54 -04:00
|
|
|
|
|
|
|
const PackageVersions = require('./app/src/infrastructure/PackageVersions')
|
2024-01-04 07:31:13 -05:00
|
|
|
const invalidateBabelCacheIfNeeded = require('./frontend/macros/invalidate-babel-cache-if-needed')
|
|
|
|
|
|
|
|
// Make sure that babel-macros are re-evaluated after changing the modules config
|
|
|
|
invalidateBabelCacheIfNeeded()
|
2018-01-12 06:41:02 -05:00
|
|
|
|
2018-03-21 08:08:18 -04:00
|
|
|
// Generate a hash of entry points, including modules
|
2019-10-16 06:10:54 -04:00
|
|
|
const entryPoints = {
|
2022-11-03 08:46:06 -04:00
|
|
|
tracing: './frontend/js/tracing.js',
|
2024-05-15 05:43:32 -04:00
|
|
|
'bootstrap-3': './frontend/js/bootstrap-3.ts',
|
|
|
|
'bootstrap-5': './frontend/js/bootstrap-5.ts',
|
2023-11-23 08:55:06 -05:00
|
|
|
devToolbar: './frontend/js/dev-toolbar.js',
|
2022-03-31 07:22:36 -04:00
|
|
|
'ide-detached': './frontend/js/ide-detached.js',
|
2021-09-08 05:26:18 -04:00
|
|
|
marketing: './frontend/js/marketing.js',
|
2022-10-24 09:55:28 -04:00
|
|
|
'main-style': './frontend/stylesheets/main-style.less',
|
|
|
|
'main-ieee-style': './frontend/stylesheets/main-ieee-style.less',
|
|
|
|
'main-light-style': './frontend/stylesheets/main-light-style.less',
|
2024-02-14 10:04:08 -05:00
|
|
|
'main-style-bootstrap-5':
|
|
|
|
'./frontend/stylesheets/bootstrap-5/main-style.scss',
|
2019-10-16 06:10:54 -04:00
|
|
|
}
|
|
|
|
|
2021-09-15 08:10:45 -04:00
|
|
|
// Add entrypoints for each "page"
|
|
|
|
glob
|
2023-09-28 11:32:24 -04:00
|
|
|
.sync(
|
|
|
|
path.join(__dirname, 'modules/*/frontend/js/pages/**/*.{js,jsx,ts,tsx}')
|
|
|
|
)
|
2021-09-15 08:10:45 -04:00
|
|
|
.forEach(page => {
|
|
|
|
// in: /workspace/services/web/modules/foo/frontend/js/pages/bar.js
|
|
|
|
// out: modules/foo/pages/bar
|
|
|
|
const name = path
|
|
|
|
.relative(__dirname, page)
|
|
|
|
.replace(/frontend[/]js[/]/, '')
|
2023-09-28 11:32:24 -04:00
|
|
|
.replace(/.(js|jsx|ts|tsx)$/, '')
|
2021-09-15 08:10:45 -04:00
|
|
|
entryPoints[name] = './' + path.relative(__dirname, page)
|
|
|
|
})
|
|
|
|
|
2023-09-28 11:32:24 -04:00
|
|
|
glob
|
|
|
|
.sync(path.join(__dirname, 'frontend/js/pages/**/*.{js,jsx,ts,tsx}'))
|
|
|
|
.forEach(page => {
|
|
|
|
// in: /workspace/services/web/frontend/js/pages/marketing/homepage.js
|
|
|
|
// out: pages/marketing/homepage
|
|
|
|
const name = path
|
|
|
|
.relative(path.join(__dirname, 'frontend/js/'), page)
|
|
|
|
.replace(/.(js|jsx|ts|tsx)$/, '')
|
|
|
|
entryPoints[name] = './' + path.relative(__dirname, page)
|
|
|
|
})
|
2021-09-08 05:26:18 -04:00
|
|
|
|
2022-02-07 06:46:51 -05:00
|
|
|
function getModuleDirectory(moduleName) {
|
|
|
|
const entrypointPath = require.resolve(moduleName)
|
|
|
|
const suffix = `node_modules/${moduleName}`
|
|
|
|
const idx = entrypointPath.indexOf(suffix)
|
|
|
|
if (idx === -1) {
|
|
|
|
throw new Error(`could not find Node module: ${moduleName}`)
|
|
|
|
}
|
|
|
|
return entrypointPath.slice(0, idx + suffix.length)
|
|
|
|
}
|
|
|
|
|
|
|
|
const mathjaxDir = getModuleDirectory('mathjax')
|
2024-10-02 04:25:02 -04:00
|
|
|
const dictionariesDir = getModuleDirectory('@overleaf/dictionaries')
|
2022-03-18 06:27:29 -04:00
|
|
|
|
2023-11-14 04:51:30 -05:00
|
|
|
const pdfjsVersions = ['pdfjs-dist213', 'pdfjs-dist401']
|
2022-02-07 06:46:51 -05:00
|
|
|
|
2022-03-30 05:49:41 -04:00
|
|
|
const vendorDir = path.join(__dirname, 'frontend/js/vendor')
|
|
|
|
|
2023-08-23 06:17:37 -04:00
|
|
|
const MATHJAX_VERSION = require('mathjax/package.json').version
|
|
|
|
if (MATHJAX_VERSION !== PackageVersions.version.mathjax) {
|
|
|
|
throw new Error(
|
|
|
|
'"mathjax" version de-synced, update services/web/app/src/infrastructure/PackageVersions.js'
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-10-02 04:25:02 -04:00
|
|
|
const DICTIONARIES_VERSION =
|
|
|
|
require('@overleaf/dictionaries/package.json').version
|
|
|
|
if (DICTIONARIES_VERSION !== PackageVersions.version.dictionaries) {
|
|
|
|
throw new Error(
|
|
|
|
'"@overleaf/dictionaries" version de-synced, update services/web/app/src/infrastructure/PackageVersions.js'
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-01-12 06:41:02 -05:00
|
|
|
module.exports = {
|
2019-08-06 08:20:02 -04:00
|
|
|
// Defines the "entry point(s)" for the application - i.e. the file which
|
|
|
|
// bootstraps the application
|
|
|
|
entry: entryPoints,
|
2018-01-12 06:41:02 -05:00
|
|
|
|
2019-08-06 08:20:02 -04:00
|
|
|
// Define where and how the bundle will be output to disk
|
|
|
|
// Note: webpack-dev-server does not write the bundle to disk, instead it is
|
|
|
|
// kept in memory for speed
|
|
|
|
output: {
|
2022-03-30 05:49:41 -04:00
|
|
|
path: path.join(__dirname, 'public'),
|
2018-01-12 06:41:02 -05:00
|
|
|
|
2021-09-08 04:24:14 -04:00
|
|
|
publicPath: '/',
|
|
|
|
|
2019-11-28 05:20:22 -05:00
|
|
|
// By default write into js directory
|
2022-04-06 05:59:13 -04:00
|
|
|
filename: 'js/[name]-[contenthash].js',
|
2018-01-12 06:41:02 -05:00
|
|
|
|
2019-08-06 08:20:02 -04:00
|
|
|
// Output as UMD bundle (allows main JS to import with CJS, AMD or global
|
|
|
|
// style code bundles
|
|
|
|
libraryTarget: 'umd',
|
|
|
|
// Name the exported variable from output bundle
|
2021-04-27 03:52:58 -04:00
|
|
|
library: ['Frontend', '[name]'],
|
2019-08-06 08:20:02 -04:00
|
|
|
},
|
2018-01-12 06:41:02 -05:00
|
|
|
|
2023-09-14 04:18:35 -04:00
|
|
|
optimization: {
|
|
|
|
// https://webpack.js.org/plugins/split-chunks-plugin/#splitchunkschunks
|
|
|
|
splitChunks: {
|
|
|
|
chunks: 'all', // allow non-async chunks to be analysed for shared modules
|
|
|
|
},
|
2024-08-01 04:38:44 -04:00
|
|
|
// https://webpack.js.org/configuration/optimization/#optimizationruntimechunk
|
|
|
|
runtimeChunk: {
|
|
|
|
name: 'runtime',
|
|
|
|
},
|
2023-09-14 04:18:35 -04:00
|
|
|
},
|
|
|
|
|
2019-08-06 08:20:02 -04:00
|
|
|
// Define how file types are handled by webpack
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
2023-01-09 07:52:55 -05:00
|
|
|
// Pass application JS/TS files through babel-loader,
|
|
|
|
// transpiling to targets defined in browserslist
|
|
|
|
test: /\.([jt]sx?|[cm]js)$/,
|
|
|
|
// Only compile application files and specific dependencies
|
|
|
|
// (other npm and vendored dependencies must be in ES5 already)
|
2024-08-14 06:42:18 -04:00
|
|
|
exclude: [
|
2024-09-05 09:04:01 -04:00
|
|
|
/node_modules\/(?!(react-dnd|chart\.js|@uppy|pdfjs-dist401|react-resizable-panels)\/)/,
|
2024-08-14 06:42:18 -04:00
|
|
|
vendorDir,
|
|
|
|
],
|
2019-08-06 08:20:02 -04:00
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
|
|
|
// Configure babel-loader to cache compiled output so that
|
|
|
|
// subsequent compile runs are much faster
|
2021-04-27 03:52:58 -04:00
|
|
|
cacheDirectory: true,
|
2022-03-30 05:49:41 -04:00
|
|
|
configFile: path.join(__dirname, './babel.config.json'),
|
2022-09-14 07:03:27 -04:00
|
|
|
plugins: [
|
|
|
|
process.env.REACT_REFRESH && 'react-refresh/babel',
|
|
|
|
].filter(Boolean),
|
2021-04-27 03:52:58 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2022-04-06 05:59:13 -04:00
|
|
|
type: 'javascript/auto',
|
2021-05-17 05:38:18 -04:00
|
|
|
},
|
2024-10-02 04:25:02 -04:00
|
|
|
{
|
|
|
|
test: /\.wasm$/,
|
|
|
|
type: 'asset/resource',
|
|
|
|
generator: {
|
|
|
|
filename: 'js/[name]-[contenthash][ext]',
|
|
|
|
},
|
|
|
|
},
|
2019-11-28 05:20:22 -05:00
|
|
|
{
|
|
|
|
// Pass Less files through less-loader/css-loader/mini-css-extract-
|
|
|
|
// plugin (note: run in reverse order)
|
|
|
|
test: /\.less$/,
|
|
|
|
use: [
|
|
|
|
// Allows the CSS to be extracted to a separate .css file
|
|
|
|
{ loader: MiniCssExtractPlugin.loader },
|
|
|
|
// Resolves any CSS dependencies (e.g. url())
|
|
|
|
{ loader: 'css-loader' },
|
|
|
|
{
|
|
|
|
// Runs autoprefixer on CSS via postcss
|
|
|
|
loader: 'postcss-loader',
|
|
|
|
options: {
|
2022-04-06 05:59:13 -04:00
|
|
|
postcssOptions: {
|
|
|
|
plugins: ['autoprefixer'],
|
|
|
|
},
|
2021-04-27 03:52:58 -04:00
|
|
|
},
|
2019-11-28 05:20:22 -05:00
|
|
|
},
|
2023-11-02 08:53:02 -04:00
|
|
|
// Compile Less off the main event loop
|
|
|
|
{
|
|
|
|
loader: 'thread-loader',
|
|
|
|
options: {
|
|
|
|
// keep workers alive for dev-server, and shut them down when not needed
|
|
|
|
poolTimeout:
|
|
|
|
process.env.NODE_ENV === 'development' ? 10 * 60 * 1000 : 500,
|
|
|
|
// bring up more workers after they timed out
|
|
|
|
poolRespawn: true,
|
|
|
|
// limit concurrency (one per entrypoint and let the small includes queue up)
|
|
|
|
workers: 6,
|
|
|
|
},
|
|
|
|
},
|
2019-11-28 05:20:22 -05:00
|
|
|
// Compiles the Less syntax to CSS
|
2021-04-27 03:52:58 -04:00
|
|
|
{ loader: 'less-loader' },
|
|
|
|
],
|
2019-11-28 05:20:22 -05:00
|
|
|
},
|
2024-02-14 10:04:08 -05:00
|
|
|
{
|
|
|
|
// Pass Sass files through sass-loader/css-loader/mini-css-extract-
|
|
|
|
// plugin (note: run in reverse order)
|
|
|
|
test: /\.s[ac]ss$/,
|
|
|
|
use: [
|
|
|
|
// Allows the CSS to be extracted to a separate .css file
|
|
|
|
{ loader: MiniCssExtractPlugin.loader },
|
|
|
|
// Resolves any CSS dependencies (e.g. url())
|
|
|
|
{ loader: 'css-loader' },
|
|
|
|
// Resolve relative paths sensibly in SASS
|
|
|
|
{ loader: 'resolve-url-loader' },
|
|
|
|
{
|
|
|
|
// Runs autoprefixer on CSS via postcss
|
|
|
|
loader: 'postcss-loader',
|
|
|
|
options: {
|
|
|
|
postcssOptions: {
|
|
|
|
plugins: ['autoprefixer'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// Compile Sass off the main event loop
|
|
|
|
{
|
|
|
|
loader: 'thread-loader',
|
|
|
|
options: {
|
|
|
|
// keep workers alive for dev-server, and shut them down when not needed
|
|
|
|
poolTimeout:
|
|
|
|
process.env.NODE_ENV === 'development' ? 10 * 60 * 1000 : 500,
|
|
|
|
// bring up more workers after they timed out
|
|
|
|
poolRespawn: true,
|
|
|
|
// limit concurrency (one per entrypoint and let the small includes queue up)
|
|
|
|
workers: 6,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// Compiles Sass to CSS
|
|
|
|
{
|
|
|
|
loader: 'sass-loader',
|
|
|
|
options: { sourceMap: true }, // sourceMap: true is required for resolve-url-loader
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2021-03-18 05:52:36 -04:00
|
|
|
{
|
|
|
|
// Pass CSS files through css-loader & mini-css-extract-plugin (note: run in reverse order)
|
|
|
|
test: /\.css$/i,
|
2021-04-27 03:52:58 -04:00
|
|
|
use: [MiniCssExtractPlugin.loader, 'css-loader'],
|
2021-03-18 05:52:36 -04:00
|
|
|
},
|
2020-01-29 05:25:33 -05:00
|
|
|
{
|
|
|
|
// Load fonts
|
2023-01-11 08:20:28 -05:00
|
|
|
test: /\.(woff2?|ttf|otf)$/,
|
2022-04-06 05:59:13 -04:00
|
|
|
type: 'asset/resource',
|
|
|
|
generator: {
|
|
|
|
filename: 'fonts/[name]-[contenthash][ext]',
|
|
|
|
},
|
2020-01-29 05:25:33 -05:00
|
|
|
},
|
2021-09-30 07:29:25 -04:00
|
|
|
{
|
|
|
|
// Load images (static files)
|
|
|
|
test: /\.(svg|gif|png|jpg|pdf)$/,
|
2022-04-06 05:59:13 -04:00
|
|
|
type: 'asset/resource',
|
|
|
|
generator: {
|
|
|
|
filename: 'images/[name]-[contenthash][ext]',
|
|
|
|
},
|
2021-09-30 07:29:25 -04:00
|
|
|
},
|
2019-08-06 08:20:02 -04:00
|
|
|
{
|
2019-10-16 06:10:54 -04:00
|
|
|
// These options are necessary for handlebars to have access to helper
|
2019-08-06 08:20:02 -04:00
|
|
|
// methods
|
|
|
|
test: /\.handlebars$/,
|
|
|
|
loader: 'handlebars-loader',
|
|
|
|
options: {
|
|
|
|
compat: true,
|
|
|
|
knownHelpersOnly: false,
|
2021-04-27 03:52:58 -04:00
|
|
|
runtimePath: 'handlebars/runtime',
|
|
|
|
},
|
2019-10-16 06:10:54 -04:00
|
|
|
},
|
2020-09-03 05:23:34 -04:00
|
|
|
{
|
|
|
|
// Load translations files with custom loader, to extract and apply
|
|
|
|
// fallbacks
|
|
|
|
test: /locales\/(\w{2}(-\w{2})?)\.json$/,
|
|
|
|
use: [
|
|
|
|
{
|
2022-03-30 05:49:41 -04:00
|
|
|
loader: path.join(__dirname, 'frontend/translations-loader.js'),
|
2021-04-27 03:52:58 -04:00
|
|
|
},
|
|
|
|
],
|
2020-09-03 05:23:34 -04:00
|
|
|
},
|
2021-04-27 03:52:58 -04:00
|
|
|
],
|
2019-08-06 08:20:02 -04:00
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
2023-09-01 07:03:47 -04:00
|
|
|
// custom prefixes for import paths
|
|
|
|
'@': path.resolve(__dirname, './frontend/js/'),
|
2021-04-27 03:52:58 -04:00
|
|
|
},
|
2023-01-05 05:16:39 -05:00
|
|
|
// symlinks: false, // enable this while using `npm link`
|
2023-11-14 04:51:30 -05:00
|
|
|
extensions: ['.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs', '.json'],
|
2022-04-06 05:59:13 -04:00
|
|
|
fallback: {
|
|
|
|
events: require.resolve('events'),
|
2024-02-05 06:44:05 -05:00
|
|
|
// for react-dnd + React 17
|
|
|
|
'react/jsx-runtime': 'react/jsx-runtime.js',
|
|
|
|
'react/jsx-dev-runtime': 'react/jsx-dev-runtime.js',
|
2021-04-27 03:52:58 -04:00
|
|
|
},
|
2019-10-16 06:10:54 -04:00
|
|
|
},
|
|
|
|
|
2024-10-02 04:25:02 -04:00
|
|
|
experiments: {
|
|
|
|
asyncWebAssembly: true,
|
|
|
|
},
|
|
|
|
|
2019-10-16 06:10:54 -04:00
|
|
|
plugins: [
|
2022-06-23 04:19:07 -04:00
|
|
|
new LezerGrammarCompilerPlugin(),
|
|
|
|
|
2019-10-16 06:10:54 -04:00
|
|
|
// Generate a manifest.json file which is used by the backend to map the
|
|
|
|
// base filenames to the generated output filenames
|
2021-09-08 04:24:14 -04:00
|
|
|
new WebpackAssetsManifest({
|
|
|
|
entrypoints: true,
|
|
|
|
publicPath: true,
|
2022-04-06 05:59:13 -04:00
|
|
|
output: 'manifest.json',
|
|
|
|
}),
|
|
|
|
|
|
|
|
new webpack.EnvironmentPlugin({
|
2022-04-06 06:14:43 -04:00
|
|
|
// Ensure that process.env.RESET_APP_DATA_TIMER is defined, to avoid an error.
|
|
|
|
// https://github.com/algolia/algoliasearch-client-javascript/issues/756
|
2022-04-06 05:59:13 -04:00
|
|
|
RESET_APP_DATA_TIMER: '120000',
|
2022-04-06 06:14:43 -04:00
|
|
|
// Ensure that process.env.CYPRESS is defined (see utils/worker.js)
|
|
|
|
CYPRESS: false,
|
2019-10-16 06:10:54 -04:00
|
|
|
}),
|
|
|
|
|
2020-01-07 10:23:54 -05:00
|
|
|
// Prevent moment from loading (very large) locale files that aren't used
|
|
|
|
new webpack.IgnorePlugin({
|
|
|
|
resourceRegExp: /^\.\/locale$/,
|
2021-04-27 03:52:58 -04:00
|
|
|
contextRegExp: /moment$/,
|
2020-01-07 10:23:54 -05:00
|
|
|
}),
|
2019-10-16 06:10:54 -04:00
|
|
|
|
2024-08-01 04:39:15 -04:00
|
|
|
// Set window.$ and window.jQuery
|
|
|
|
new webpack.ProvidePlugin({
|
|
|
|
$: 'jquery',
|
|
|
|
jQuery: 'jquery',
|
|
|
|
}),
|
|
|
|
|
2021-03-04 11:10:51 -05:00
|
|
|
// Copy the required files for loading MathJax from MathJax NPM package
|
2022-04-06 05:59:13 -04:00
|
|
|
new CopyPlugin({
|
|
|
|
patterns: [
|
2023-01-23 06:41:24 -05:00
|
|
|
// https://www.npmjs.com/package/mathjax#user-content-hosting-your-own-copy-of-the-mathjax-components
|
|
|
|
{
|
|
|
|
from: 'es5/tex-svg-full.js',
|
2024-02-08 04:34:07 -05:00
|
|
|
to: `js/libs/mathjax-${PackageVersions.version.mathjax}/es5`,
|
2023-11-07 06:52:06 -05:00
|
|
|
toType: 'dir',
|
2024-02-08 04:34:07 -05:00
|
|
|
context: mathjaxDir,
|
2023-01-23 06:41:24 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
from: 'es5/input/tex/extensions/**/*.js',
|
2024-02-08 04:34:07 -05:00
|
|
|
to: `js/libs/mathjax-${PackageVersions.version.mathjax}`,
|
2023-11-07 06:52:06 -05:00
|
|
|
toType: 'dir',
|
2024-02-08 04:34:07 -05:00
|
|
|
context: mathjaxDir,
|
2023-01-23 06:41:24 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
from: 'es5/ui/**/*',
|
2024-02-08 04:34:07 -05:00
|
|
|
to: `js/libs/mathjax-${PackageVersions.version.mathjax}`,
|
2023-11-07 06:52:06 -05:00
|
|
|
toType: 'dir',
|
2022-04-06 05:59:13 -04:00
|
|
|
context: mathjaxDir,
|
|
|
|
},
|
|
|
|
{
|
2024-02-08 04:34:07 -05:00
|
|
|
from: 'es5/a11y/**/*',
|
|
|
|
to: `js/libs/mathjax-${PackageVersions.version.mathjax}`,
|
|
|
|
toType: 'dir',
|
2022-04-06 05:59:13 -04:00
|
|
|
context: mathjaxDir,
|
|
|
|
},
|
|
|
|
{
|
2024-02-08 04:34:07 -05:00
|
|
|
from: 'es5/input/mml.js',
|
|
|
|
to: `js/libs/mathjax-${PackageVersions.version.mathjax}/es5/input`,
|
|
|
|
toType: 'dir',
|
2022-04-06 05:59:13 -04:00
|
|
|
context: mathjaxDir,
|
|
|
|
},
|
|
|
|
{
|
2024-02-08 04:34:07 -05:00
|
|
|
from: 'es5/sre/**/*',
|
|
|
|
to: `js/libs/mathjax-${PackageVersions.version.mathjax}`,
|
|
|
|
toType: 'dir',
|
2022-04-06 05:59:13 -04:00
|
|
|
context: mathjaxDir,
|
|
|
|
},
|
2024-10-02 04:25:02 -04:00
|
|
|
{
|
|
|
|
from: '*',
|
|
|
|
to: `js/dictionaries/${PackageVersions.version.dictionaries}`,
|
|
|
|
toType: 'dir',
|
|
|
|
context: `${dictionariesDir}/dictionaries`,
|
|
|
|
},
|
2022-04-06 05:59:13 -04:00
|
|
|
...pdfjsVersions.flatMap(version => {
|
|
|
|
const dir = getModuleDirectory(version)
|
2022-03-30 05:49:41 -04:00
|
|
|
|
2022-04-06 05:59:13 -04:00
|
|
|
// Copy CMap files (used to provide support for non-Latin characters)
|
|
|
|
// and static images from pdfjs-dist package to build output.
|
2022-03-18 06:27:29 -04:00
|
|
|
|
2022-04-06 05:59:13 -04:00
|
|
|
return [
|
|
|
|
{ from: `cmaps`, to: `js/${version}/cmaps`, context: dir },
|
2022-07-27 06:15:43 -04:00
|
|
|
{
|
|
|
|
from: `standard_fonts`,
|
|
|
|
to: `fonts/${version}`,
|
|
|
|
context: dir,
|
|
|
|
},
|
2022-04-06 05:59:13 -04:00
|
|
|
{
|
|
|
|
from: `legacy/web/images`,
|
|
|
|
to: `images/${version}`,
|
|
|
|
context: dir,
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
}),
|
2021-04-27 03:52:58 -04:00
|
|
|
],
|
2018-03-29 11:15:53 -04:00
|
|
|
}
|