51
6
52
18

Official docs say it's for

Packages that are only needed for local development and testing.

Umm, okay. Not 100% clear there. Some articles mention things like ESLint or Jest (k, I'm onboard there) but others mention Babel or WebPack. I get that you don't need WebPack libraries to be loaded in the browser but how the hell do you bundle up your code without it? When you use npm ci or npm install you'll get all dependencies but isn't it good practice (in a CICD environment) to use --omit=dev or --only=prod?

53
33
submitted 8 months ago by libreom to c/javascript@programming.dev

We need to exert more pressure on apple and eu to not remove PWAs. Every signature counts, please sign and share EU has already started a preliminary investigation on this http://archive.today/2024.02.26-223134/https://www.ft.com/content/d2f7328c-5851-4f16-8f8d-93f0098b6adc

54
6
55
22
submitted 8 months ago by libreom to c/javascript@programming.dev

Apple has decided to remove Progressive web apps from iOS in EU. If you have a business in the EU or serve EU users via Web App/PWA, we must hear from you in the next 48 hours!

56
9

Hi,

For the moderators of this community:

I've just cross-posted one of my post and I got from this bot Automod@programming.dev

your post xxx has been removed as you do not have enough activity on your account to create image posts in that community

Hopefully I saw the message, because I could really have miss it ! is that necessary ?

57
6

cross-posted from: https://lemmy.today/post/6812682

Hi,

I'm using stripe.PaymentIntent (server side)

and Stripe.js for the client side.

everything work flawlessly under Firefox. !

With Chrome it's another story... First of all a .js file is being loaded !! ^1 Then in the browser console I received this error:

[Stripe.js] You have not registered or verified the domain, so the following payment methods are not enabled in the Payment Element:

  • apple_pay

Funny thing is that in the Stripe "dashboard" is that the apple_pay is not enabled.. and it work in Firefox..

Any ideas ?

58
7
submitted 9 months ago* (last edited 9 months ago) by erayerdin@programming.dev to c/javascript@programming.dev

If you're a library developer for Javascript or Typescript, a new badge to show unpacked size of your packages is now available.

Badge URL format:

https://img.shields.io/npm/unpacked-size/npmPackageName
59
1

This exercise will demonstrate how to create page elements dynamically and how to use a global value to easily be able to update the page contents. Use of document.createElement() to dynamically create page elements and how to append them to the web page with appendChild().

60
24
61
24
62
13

Why .7 and not .5? The world may never know.

63
16
64
0
65
3
66
17
const { promise, resolve, reject } = Promise.withResolvers();
67
8
import json from './foo.json' with { type: 'json' };
68
20
69
21

I've been enjoying this library for advanced list filtering and search operations lately. Just wanted to share for those that haven't heard of it

70
4

I've been writing a hook+component library for React and Firebase, the source of which can be seen here.

It reached to a certain stability. My current goal is to reduce the size as much as possible. I've checked documents and stuff and this is the vite.config.ts that I have:

import peerDepsExternal from "rollup-plugin-peer-deps-external";
import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
import { peerDependencies } from "./package.json";

export default defineConfig({
  build: {
    lib: {
      entry: "./src/index.ts", // Specifies the entry point for building the library.
      name: "firereact", // Sets the name of the generated library.
      fileName: (format) => `index.${format}.js`, // Generates the output file name based on the format.
      formats: ["cjs", "es"], // Specifies the output formats (CommonJS and ES modules).
    },
    rollupOptions: {
      external: [...Object.keys(peerDependencies)], // Defines external dependencies for Rollup bundling.
    },
    sourcemap: true, // Generates source maps for debugging.
    emptyOutDir: true, // Clears the output directory before building.
  },
  plugins: [dts(), peerDepsExternal()], // Uses the 'vite-plugin-dts' plugin for generating TypeScript declaration files (d.ts).
});

build.lib.rollupOptions.external is to be expected: It gets peer dependencies from package.json. peerDepsExternal helps to not bundle the dependencies of peer dependencies.

Still, I've thought the final size is not that reasonable compared to some similar libraries.

That's why I've checked what's being included with npx vite-bundle-visualizer.

Seems like @firebase is being included to the final library. I can also confirm it with less dist/index.es.js and see @firebase being mangled.

Firebase is a peer dependency so it shouldn't be bundled to the final library (or maybe I misunderstand something cruicial about peerDependencies).

How do I exclude @firebase from the library?


Troubleshooting

Here are some ways that I've tried to remove @firebase from the final library:

  • Tried to manually add it into build.lib.rollupOptions.external in vite.config.ts.
  • Played with some settings in tsconfig.json.
71
12
72
10
73
7
submitted 9 months ago* (last edited 9 months ago) by Rick_C137@programming.dev to c/javascript@programming.dev

~~ cross-posted from: https://programming.dev/post/9179830 ~~

Hi,

I'm loading some content with XHR (aka Ajax) the loaded input elements that have a invalid value assigned are not checked trough the validation process.

so the CSS styling with :invalid is for example not working etc..

is there a way to force the validation process on those elements ?

edit: Browser is Firefox

Thanks.

74
6
75
1
view more: ‹ prev next ›

JavaScript

1700 readers
1 users here now

founded 1 year ago
MODERATORS