public/manifest: use variables for program name

This requires a craco hack due to https://github.com/facebook/create-react-app/issues/7953
This commit is contained in:
David Lechner
2021-06-23 14:28:59 -05:00
parent 411e8e64d5
commit 944770fa98
2 changed files with 19 additions and 3 deletions
+17 -1
View File
@@ -188,6 +188,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.`,
module.exports = {
webpack: {
plugins: [
new CopyPlugin({
patterns: [
{
from: 'public/manifest.json',
transform(content, path) {
return content
.toString()
.replace(
/%\w+%/g,
(m) => process.env[m.slice(1, m.length - 1)],
);
},
},
],
}),
new CopyPlugin({
patterns: [
{
@@ -248,7 +263,8 @@ module.exports = {
webpackConfig,
loaderByName('babel-loader'),
);
babelLoaders.matches[0].loader.test = /\.(esnext|js|mjs|jsx|ts|tsx)$/;
babelLoaders.matches[0].loader.test =
/\.(esnext|js|mjs|jsx|ts|tsx)$/;
babelLoaders.matches[1].loader.test = /\.(esnext|js|mjs)$/;
const fileLoader = getLoader(
+2 -2
View File
@@ -1,6 +1,6 @@
{
"short_name": "Pybricks Code",
"name": "Pybricks Code",
"short_name": "%REACT_APP_NAME%",
"name": "%REACT_APP_NAME%",
"icons": [
{
"src": "favicon.ico",