♻️(frontend) adapt emoji copying to turbopack build
We were previously copying the emoji assets in a webpack plugin, but that doesn't run with turbopack. This commit moves the copying to a pre-build script, which runs regardless of the bundler used.
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
const crypto = require('crypto');
|
||||
const path = require('path');
|
||||
|
||||
const CopyPlugin = require('copy-webpack-plugin');
|
||||
const { InjectManifest } = require('workbox-webpack-plugin');
|
||||
|
||||
const buildId = crypto.randomBytes(256).toString('hex').slice(0, 8);
|
||||
@@ -54,22 +52,6 @@ const nextConfig = {
|
||||
},
|
||||
);
|
||||
|
||||
// Copy necessary fonts from node_modules to public directory during build or dev
|
||||
config.plugins.push(
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
{
|
||||
from: path.resolve(
|
||||
__dirname,
|
||||
'../../node_modules/emoji-datasource-apple/img/apple/64',
|
||||
),
|
||||
to: path.resolve(__dirname, 'public/assets/fonts/emoji'),
|
||||
force: true,
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
|
||||
if (!isServer && process.env.NEXT_PUBLIC_SW_DEACTIVATED !== 'true') {
|
||||
config.plugins.push(
|
||||
new InjectManifest({
|
||||
|
||||
@@ -93,7 +93,6 @@
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"@vitejs/plugin-react": "5.1.4",
|
||||
"copy-webpack-plugin": "13.0.1",
|
||||
"cross-env": "10.1.0",
|
||||
"dotenv": "17.3.1",
|
||||
"eslint-plugin-docs": "*",
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Copies Apple emoji images from emoji-datasource-apple into the public directory.
|
||||
* Used as a pre-step for both `dev` (Turbopack) and `build` (webpack) so that
|
||||
* neither pipeline needs a webpack CopyPlugin for this purpose.
|
||||
*/
|
||||
import { cpSync } from 'fs';
|
||||
import { resolve, dirname } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
const src = resolve(
|
||||
__dirname,
|
||||
'../../../node_modules/emoji-datasource-apple/img/apple/64',
|
||||
);
|
||||
const dest = resolve(__dirname, '../public/assets/fonts/emoji');
|
||||
|
||||
cpSync(src, dest, { recursive: true, force: true });
|
||||
|
||||
console.log('✔ Emoji assets copied to public/assets/fonts/emoji');
|
||||
@@ -2,3 +2,4 @@
|
||||
* Pre-build script: runs all setup tasks required before `next build`.
|
||||
* Add future build preparation steps here.
|
||||
*/
|
||||
import './copy-emoji.mjs';
|
||||
|
||||
+3
-14
@@ -9078,17 +9078,6 @@ cookiejar@^2.1.4:
|
||||
resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.4.tgz#ee669c1fea2cf42dc31585469d193fef0d65771b"
|
||||
integrity sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==
|
||||
|
||||
[email protected]:
|
||||
version "13.0.1"
|
||||
resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-13.0.1.tgz#fba18c22bcab3633524e1b652580ff4489eddc0d"
|
||||
integrity sha512-J+YV3WfhY6W/Xf9h+J1znYuqTye2xkBUIGyTPWuBAT27qajBa5mR4f8WBmfDY3YjRftT2kqZZiLi1qf0H+UOFw==
|
||||
dependencies:
|
||||
glob-parent "^6.0.1"
|
||||
normalize-path "^3.0.0"
|
||||
schema-utils "^4.2.0"
|
||||
serialize-javascript "^6.0.2"
|
||||
tinyglobby "^0.2.12"
|
||||
|
||||
core-js-compat@^3.43.0:
|
||||
version "3.46.0"
|
||||
resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.46.0.tgz#0c87126a19a1af00371e12b02a2b088a40f3c6f7"
|
||||
@@ -10741,7 +10730,7 @@ glob-parent@^5.1.2, glob-parent@~5.1.2:
|
||||
dependencies:
|
||||
is-glob "^4.0.1"
|
||||
|
||||
glob-parent@^6.0.1, glob-parent@^6.0.2:
|
||||
glob-parent@^6.0.2:
|
||||
version "6.0.2"
|
||||
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3"
|
||||
integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==
|
||||
@@ -15192,7 +15181,7 @@ scheduler@^0.27.0:
|
||||
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.27.0.tgz#0c4ef82d67d1e5c1e359e8fc76d3a87f045fe5bd"
|
||||
integrity sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==
|
||||
|
||||
schema-utils@^4.2.0, schema-utils@^4.3.0, schema-utils@^4.3.3:
|
||||
schema-utils@^4.3.0, schema-utils@^4.3.3:
|
||||
version "4.3.3"
|
||||
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-4.3.3.tgz#5b1850912fa31df90716963d45d9121fdfc09f46"
|
||||
integrity sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==
|
||||
@@ -16070,7 +16059,7 @@ tinyexec@^1.0.2:
|
||||
resolved "https://registry.yarnpkg.com/tinyexec/-/tinyexec-1.0.2.tgz#bdd2737fe2ba40bd6f918ae26642f264b99ca251"
|
||||
integrity sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==
|
||||
|
||||
tinyglobby@^0.2.12, tinyglobby@^0.2.13, tinyglobby@^0.2.15:
|
||||
tinyglobby@^0.2.13, tinyglobby@^0.2.15:
|
||||
version "0.2.15"
|
||||
resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.15.tgz#e228dd1e638cea993d2fdb4fcd2d4602a79951c2"
|
||||
integrity sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==
|
||||
|
||||
Reference in New Issue
Block a user