GithubHelp home page GithubHelp logo

usmanyunusov / webpack-webmanifest-loader Goto Github PK

View Code? Open in Web Editor NEW
18.0 18.0 5.0 184 KB

Minimalistic webpack loader to generate webmanifest file (and process icons URLs).

Home Page: https://npm.im/webpack-webmanifest-loader

License: MIT License

JavaScript 100.00%
webmanifest webpack-loader

webpack-webmanifest-loader's Introduction

webpack-webmanifest-loader's People

Contributors

ai avatar usmanyunusov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

webpack-webmanifest-loader's Issues

Add ChaneLog

I see 0.0.41.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 file
  • GitHub Releases (just create git tag for the release and fill changes in Releases page)

Reduce npm package size

  1. Add clean-publish and release package by npx clean-publish instead of npm publish
  2. Add .npmignore to avoid adding test/ (current src/) to npm package

Unclear error on missed `this[NAMESPACE].options.manifest`

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.

Manifest require return empty object

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 doesn’t work

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)

Rename the project

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.