Registry / devops / grunt-es6-module-wrap-default

grunt-es6-module-wrap-default

JSON →
library0.2.0jsnpmunverified

Grunt plugin (v0.2.0) that wraps CommonJS and AMD modules generated by es6-module-transpiler so they can be required by their name rather than requiring `.default`. It helps transition from ES6 modules to CommonJS/AMD without changing consumer code. The plugin is minimal, specific to the es6-module-transpiler output, and provides a `type` option to choose between CJS and AMD wrapping. Release cadence is unknown; last release was 2014. It has no known alternatives for this exact use case.

npm install grunt-es6-module-wrap-default
INSTALL
IMPORT
SIG · GRUNT-ES6-MODULE-W
G
grunt-es6-module-wrap-default
devopsjavascriptv0.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

es6_module_wrap_default
grunt.loadNpmTasks('grunt-es6-module-wrap-default');
import es6_module_wrap_default from 'grunt-es6-module-wrap-default';
Grunt plugin: register via loadNpmTasks, not import.
es6_module_wrap_default task config
grunt.initConfig({ es6_module_wrap_default: { ... } });
grunt.initConfig({ es6ModuleWrapDefault: { ... } });
Task name in config must be string 'es6_module_wrap_default' as per Grunt convention.
options.type
options: { type: 'cjs' }
options: { format: 'amd' }
Only 'cjs' or 'amd' are accepted; 'format' is not a valid option.

Registers the Grunt task and configures it to wrap CJS files from a source directory to an output directory, enabling require('name') instead of require('name').default.

// Install: npm install grunt-es6-module-wrap-default --save-dev // In Gruntfile.js: module.exports = function(grunt) { grunt.loadNpmTasks('grunt-es6-module-wrap-default'); grunt.initConfig({ es6_module_wrap_default: { options: { type: 'cjs' }, files: [{ expand: true, cwd: 'cjs/transpiled', src: ['**/*.js'], dest: 'cjs' }] } }); grunt.registerTask('default', ['es6_module_wrap_default']); };
Debug
Known issues
gotchaOnly works with output from es6-module-transpiler; other ES6 transpilers may not produce compatible modules.
fix
Verify that your modules were generated by es6-module-transpiler.
affects: >=0.0.0
deprecatedes6-module-transpiler is deprecated; consider using Babel or TypeScript for ES6 module transpilation.
fix
Migrate to Babel or TypeScript, which handle imports directly and do not require wrapping.
affects: >=0.1.0
gotchaTask configuration uses 'es6_module_wrap_default' as the property name; misspelling or incorrect casing will not throw an error—silent failure.
fix
Ensure the property name exactly matches 'es6_module_wrap_default'.
affects: >=0.0.0
gotchaIf no files are matched, the task completes without any output—no error.
fix
Double-check file glob patterns and cwd.
affects: >=0.0.0
Errors
Common errors & fixes
Warning: Task "es6_module_wrap_default" not found.
The task is not registered; grunt.loadNpmTasks was not called or the plugin is not installed.
fix
Add `grunt.loadNpmTasks('grunt-es6-module-wrap-default');` to your Gruntfile.
Fatal error: Unable to read task "es6_module_wrap_default" options.
Invalid configuration; the property name may be misspelled or options are not an object.
fix
Ensure your Gruntfile has a property named exactly 'es6_module_wrap_default' with valid options.
No files matched.
The source file glob pattern is incorrect or the directory does not exist.
fix
Check the file paths and cwd in the files configuration.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies
gruntrequiredpeer dependency (Grunt ~0.4.2) required for plugin to work
Agent activity
4 hits · last 30 days
node
4
Resources
grunt-es6-module-wrap-default — npm install grunt-es6-module-wrap-default · libregistry