
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
babel-plugin-transform-vite-meta-glob
Advanced tools
babel plugin that emulates vite's import.meta.glob import.meta.globEager functionality
Please note: this plugin is intended to provide an approximation of some of Vite specific transformations when running the code in non-Vite environment, for example, running tests with a NodeJS based test runner.
The functionality within these transformations should not be relied upon in production.
In
const modules = import.meta.glob('./path/to/files/**/*')
// eager
const eagerModules = import.meta.glob('./path/to/files/**/*', { eager: true })
// deprecated eager
const deprecatedEagerModules = import.meta.globEager('./path/to/files/**/*')
Out
For the purposes of this example, assume there are 3 files,
files1.js,files2.jsandfile3.jsat the path of./path/to/files/relative the files being transformed.
const modules = {
'./path/to/files/file1.js': () => import('./path/to/files/file1.js'),
'./path/to/files/file2.js': () => import(('./path/to/files/file2.js'),
'./path/to/files/file3.js': () => import(('./path/to/files/file3.js')
}
// eager
import * as __glob__0_0 from './path/to/files/file1.js'
import * as __glob__0_1 from './path/to/files/file2.js'
import * as __glob__0_2 from './path/to/files/file3.js'
const eagerModules = {
'./path/to/files/file1.js': __glob__0_1,
'./path/to/files/file2.js': __glob__0_2,
'./path/to/files/file3.js': __glob__0_3
}
// deprecated eager
const deprecatedEagerModules = {
'./path/to/files/file1.js': require('./path/to/files/file1.js'),
'./path/to/files/file2.js': require('./path/to/files/file2.js'),
'./path/to/files/file3.js': require('./path/to/files/file3.js')
}
npm install --save-dev babel-plugin-transform-vite-meta-glob
{
"plugins": ["babel-plugin-transform-vite-meta-glob"]
}
babel --plugins babel-plugin-transform-vite-meta-glob script.js
require('@babel/core').transformSync('code', {
plugins: ['babel-plugin-transform-vite-meta-glob']
})
FAQs
babel plugin that emulates vite's import.meta.glob import.meta.globEager functionality
The npm package babel-plugin-transform-vite-meta-glob receives a total of 97,390 weekly downloads. As such, babel-plugin-transform-vite-meta-glob popularity was classified as popular.
We found that babel-plugin-transform-vite-meta-glob demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.