diff options
author | ThibG <thib@sitedethib.com> | 2020-09-01 17:36:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-01 17:36:30 +0200 |
commit | d967251fdc3826ad27d30e55258cfa4cdfd7c871 (patch) | |
tree | 91926ccaedf470bfef058cc7156f9f362d46186a /config | |
parent | d95dd3883e0c7d1626f5e3b88d24af2627a641e2 (diff) | |
parent | 787a629b8f1df4cce53a9de7f3aa668cc9ef632f (diff) |
Merge pull request #1417 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'config')
-rw-r--r-- | config/webpack/rules/index.js | 2 | ||||
-rw-r--r-- | config/webpack/rules/node_modules.js | 5 | ||||
-rw-r--r-- | config/webpack/rules/tesseract.js | 14 | ||||
-rw-r--r-- | config/webpack/shared.js | 7 |
4 files changed, 20 insertions, 8 deletions
diff --git a/config/webpack/rules/index.js b/config/webpack/rules/index.js index bbf6b0187..92a384e6d 100644 --- a/config/webpack/rules/index.js +++ b/config/webpack/rules/index.js @@ -1,6 +1,7 @@ const babel = require('./babel'); const css = require('./css'); const file = require('./file'); +const tesseract = require('./tesseract'); const nodeModules = require('./node_modules'); // Webpack loaders are processed in reverse order @@ -8,6 +9,7 @@ const nodeModules = require('./node_modules'); // Lastly, process static files using file loader module.exports = { file, + tesseract, css, nodeModules, babel, diff --git a/config/webpack/rules/node_modules.js b/config/webpack/rules/node_modules.js index 7ed05504b..c084d3a57 100644 --- a/config/webpack/rules/node_modules.js +++ b/config/webpack/rules/node_modules.js @@ -4,7 +4,10 @@ const { settings, env } = require('../configuration'); module.exports = { test: /\.(js|mjs)$/, include: /node_modules/, - exclude: /@babel(?:\/|\\{1,2})runtime/, + exclude: [ + /@babel(?:\/|\\{1,2})runtime/, + /tesseract.js/, + ], use: [ { loader: 'babel-loader', diff --git a/config/webpack/rules/tesseract.js b/config/webpack/rules/tesseract.js new file mode 100644 index 000000000..de647c8d1 --- /dev/null +++ b/config/webpack/rules/tesseract.js @@ -0,0 +1,14 @@ +module.exports = { + test: [ + /tesseract\.js\/dist\/worker\.min\.js$/, + /tesseract\.js\/dist\/worker\.min\.js.map$/, + /tesseract\.js-core\/tesseract-core\.wasm$/, + /tesseract\.js-core\/tesseract-core\.wasm.js$/, + ], + use: { + loader: 'file-loader', + options: { + name: 'ocr/[name]-[hash].[ext]', + }, + }, +}; diff --git a/config/webpack/shared.js b/config/webpack/shared.js index 36b5a459e..11c321c58 100644 --- a/config/webpack/shared.js +++ b/config/webpack/shared.js @@ -5,7 +5,6 @@ const { basename, dirname, join, relative, resolve } = require('path'); const { sync } = require('glob'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const AssetsManifestPlugin = require('webpack-assets-manifest'); -const CopyPlugin = require('copy-webpack-plugin'); const { env, settings, core, flavours, output } = require('./configuration.js'); const rules = require('./rules'); const localePacks = require('./generateLocalePacks'); @@ -110,12 +109,6 @@ module.exports = { writeToDisk: true, publicPath: true, }), - new CopyPlugin({ - patterns: [ - { from: 'node_modules/tesseract.js/dist/worker.min.js', to: 'ocr' }, - { from: 'node_modules/tesseract.js-core/tesseract-core.wasm.js', to: 'ocr' }, - ], - }), ], resolve: { |