
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
@lightbase/next-preset
Advanced tools
An easy to use preset for Next.js projects at Lightbase
The following page extensions are configured by next-preset:
api.ts
, page.tsx
This means that _app.tsx
becomes _app.page.tsx
, _document.tsx
becomes _document.page.tsx
, etc.
This configuration allows the placement of component files in the /pages
directory, for storing local components with the page they're used on, without them becoming available as a route.
...
├── ...
├── src
│ ├── pages
│ │ ├── about-us
│ │ │ ├── components
│ │ │ │ └── Employee.tsx 👈 The component
│ │ │ └── index.page.tsx 👈 The page
├── ...
These headers are configured by default, because they're considered good security practice.
You can overwrite these headers by setting the header yourself in next.config.js
.
Header | Value |
---|---|
x-frame-options | deny |
content-security-policy. | frame-ancestors 'none' |
x-content-type-options | nosniff |
Referrer-Policy | same-origin |
Strict-Transport-Security | max-age=31536000 |
Permissions-Policy | interest-cohort=() |
When next-preset is used, a check is run on next build
to make sure that the output does not contain any non-ES5 JavaScript code. This is done so your app does not unexpectedly break in certain browsers.
When offending output is found, the build fails and you're notified.
[PRESET] Checking browser compatibility...
[PRESET]
You might want to add the following entries to `preset.transpileModules` in `next.config.js`:
- yup
For more information, see: https://github.com/martpie/next-transpile-modules
Most modules can be transpiled. Modules that can't be transpiled can be ignored. Be sure to check if the module can be safely ignored or if you need to take additional steps per the modules' instructions.
next-transpile-modules is included and configured by next-preset.
Modules to be transpiled can be added by setting the preset.transpileModules
option in next.config.js
.
const { withPreset } = require("@lightbase/next-preset");
module.exports = withPreset({
...
preset: {
transpileModules: [
"yup",
"dequal",
],
...
},
...
});
Some modules produce non-ES5 code and cannot be transpiled, e.g. Mapbox-GL. Usually the module does not support older browsers, so it does not make sense for them to transpile to ES5 or support it.
Modules to be ignored can be added by setting the preset.ignoreModules
option in next.config.js
.
const { withPreset } = require("@lightbase/next-preset");
module.exports = withPreset({
...
preset: {
ignoreModules: ["mapbox-gl"],
...
},
...
});
In order for the browser compatibility check to function, source maps are enabled and will be available alongside your app.
If you're using @sentry/nextjs, source maps are already enabled.
FAQs
An easy to use preset for Next.js projects at Lightbase
The npm package @lightbase/next-preset receives a total of 2 weekly downloads. As such, @lightbase/next-preset popularity was classified as not popular.
We found that @lightbase/next-preset demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.