👨💻 Последние статьи из моего блога:
Обновлено 2024-08-15 09:02
Minimalistic webpack loader to generate webmanifest file (and process icons URLs).
Home Page: https://npm.im/webpack-webmanifest-loader
License: MIT License
👨💻 Последние статьи из моего блога:
Обновлено 2024-08-15 09:02
I see 0.0.4
→ 1.0.3
update, but can’t find what was changes in a simple form.
I think all open source projects must have ChangeLog. A lot of people agree: https://keepachangelog.com/ru/1.0.0/
There are two forms for ChangeLog:
CHANGELOG.md
fileclean-publish
and release package by npx clean-publish
instead of npm publish
.npmignore
to avoid adding test/
(current src/
) to npm packageSeems like it is a test dir https://github.com/usmanyunusov/webpack-webmanifest-plugin/tree/master/src
It will be more clear if we rename it to test/
I added plugin to webpack. For some reason, loader
doesn’t work.
But the error is unclear. It will be better to explain that loader
didn’t load the manifest and suggested solution.
(node:63462) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of undefined
at /home/ai/Dev/akeero-front/node_modules/webpack-webmanifest-plugin/src/index.js:50:67
at Hook.eval [as call] (eval at create (/home/ai/Dev/akeero-front/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
at Hook.CALL_DELEGATE [as _call] (/home/ai/Dev/akeero-front/node_modules/webpack/node_modules/tapable/lib/Hook.js:14:14)
at /home/ai/Dev/akeero-front/node_modules/webpack/lib/Compilation.js:2513:40
at eval (eval at create (/home/ai/Dev/akeero-front/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:17:1)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
I use webpack 5.
To explain how to specify paths to images
I use webpack 5 and have this config:
{
test: /\.webmanifest$/,
use: [
{
loader: WebManifestPlugin.loader
}
]
},
and this template:
<link rel="manifest" href="<%=
require('~/layout/base/manifest.webmanifest')
%>" />
It generates a correct manifest file, but I got incorrect HTML:
<link rel="manifest" href="[object Object]"/>
Loader in webpack config:
{
test: /\.webmanifest$/,
use: [{ loader: WebManifestPlugin.loader }]
},
Plugins:
[
new WebManifestPlugin(),
new HtmlWebpackPlugin({ template: './view/index.html' }),
new DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
})
]
HTML template:
<link rel="manifest" href="<%=
require('../layout/base/manifest.webmanifest')
%>" />
Manifest:
{
"start_url": ".",
"background_color": "#363636",
"theme_color": "#363636",
"icons": []
}
Result:
NODE_ENV=production npx webpack
(node:67435) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of undefined
at /home/ai/Dev/akeero-front/node_modules/webpack-webmanifest-plugin/src/index.js:50:67
at Hook.eval [as call] (eval at create (/home/ai/Dev/akeero-front/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
at Hook.CALL_DELEGATE [as _call] (/home/ai/Dev/akeero-front/node_modules/webpack/node_modules/tapable/lib/Hook.js:14:14)
at /home/ai/Dev/akeero-front/node_modules/webpack/lib/Compilation.js:2513:40
at eval (eval at create (/home/ai/Dev/akeero-front/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:17:1)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
Since you do not have a plugin anymore, it is a good time to rename project.
Also, if the project will have -loader
ending, we can use use: 'X-loader'
in webpack config without import
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.