Git Product home page Git Product logo

amd_bundle.js's Introduction

AMD bundle

A multiple-use tool for bundling up AMD, CJS & ES 6 modules, which is much easier to use than r.js with Almond or AMDclean.

NPM Dependency Build Status

NPM

Recommended Usage

Basic

cd path/to/project/root

npm install amd-bundle --save-dev

amd-bundle -a -m \
    path/to/project/source/entry \
    path/to/project/bundle/file

amd-bundle will

  1. start bundling from the entry point path/to/project/source/entry.js

  2. write into path/to/project/bundle/file.js with only one define('file', [ ]) and global.file definition, just like UMD style

  3. treat ${process.cwd()}/node_modules/${module_full_name} as a user's module to pack in

  4. generate file.min.js & file.js.map in path/to/project/bundle/

More options

Command-line

amd-bundle --help

Usage: amd-bundle [options] <entry file> [bundle file]

Options:

    -V, --version      output the version number
    -a, --include-all  Bundle all dependencies (include those in "./node_modules/")
    -m, --minify       Generate minified source code & source map
    -s, --std-out      Write into "stdout" without logs
    -h, --help         output usage information

Configuration

Example

Key/value of option moduleMap is same as the basic parameters of String.prototype.replace().

JS Module

Advanced

Build standalone release files (Full source code, Minimized code & Source map) by executing a single command (npm run build).

Multiple bundles from one source

Bundle ECMAScript 6+ codes

  • Development dependency: Babel

  • NPM-scripts reference: WebCell

Typical Cases

  1. iQuery.js (where the prototype of amd-bundle came from)

  2. WebCell (where v1.0 rewritten out)

  3. WebCell DevCLI (where v1.3+ came out)

More use case

amd_bundle.js's People

Contributors

techquery avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

amd_bundle.js's Issues

amd-bundle creates incorrect code from kotlinJs amd code

I am trying to use amd-bundler with kotlinJS
the project is configured to output amd javascript modules
i invoke it like so:

node_modules/.bin/amd-bundle -m build/kotlin-js/client-js/penta build/html/js/penta

penta.js is the entry point and all modules are in the same folder

the error i am encountering is that the generated code seems to be generating in the wrong order or maybe it skips things

penta.js:94 Uncaught ReferenceError: _ is not defined
    at _module_../penta.factory (penta.js:94)
    at include (penta.js:57)
    at penta.js:19712
    at penta.js:11
    at penta.js:13
_module_../penta.factory @ penta.js:94
include @ penta.js:57
(anonymous) @ penta.js:19712
(anonymous) @ penta.js:11
(anonymous) @ penta.js:13

seems to be this code (line 94)

    var $$importsForInline$$ =
        _.$$importsForInline$$ || (_.$$importsForInline$$ = {});

this code works when i just load it with require.js and main-data attribute
i attached the input files and the generated output as well here: report.zip

the whole project is at https://github.com/NikkyAI/pentagame
to generate the js code you would run ./gradlew client-jsCopyJs

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.