Last active
August 29, 2015 13:56
-
-
Save tbranyen/8949163 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: synchronizer | |
# | |
synchronizer: | |
synchronizer lib/index.js > dist/out.js | |
@@make test | |
# R.js includes the `baseUrl` in the module normalization which incorrectly | |
# contextualizes it to the wrong location. | |
# | |
# Meaning if you have `src/main.js` and build a single file `dist/out.js` that | |
# file will not be able to run correctly as it will be trying to load modules | |
# from the `lib` directory. | |
# | |
# There is no way to easily inline a UMD wrapper, you have to use `wrap.start` | |
# and `wrap.end` to inject the strings manually. The wrapper is typically | |
# hardcoded, but could theoretically be a template that is dynamic, but I don't | |
# have any examples on how that would work. | |
# | |
# This spawns a subshell that changes the path. | |
# | |
# - Inserts a require/define shim inside an IIFE | |
# - Includes the index file. | |
# - Automatically requires the index file. | |
# - Does not optimize the output. | |
r.js: | |
(cd lib && r.js -o name=../almond wrap=true include=index insertRequire=./index optimize=none out=../dist/out.js) | |
@@make test | |
# | |
webpack: | |
webpack --devtool="source-map" --output-source-map-file="../[file].map" --output-file="./dist/out.js" --entry="./lib/index.js" | |
@@make test | |
# Unable to handle the following syntax. | |
# | |
# require(["./a/b"], function(b) { | |
# console.log(b); | |
# }); | |
# | |
# If the code is switched to: | |
# | |
# define(["./a/b"], function(b) { | |
# console.log(b); | |
# }); | |
# | |
# everything works correctly. | |
# | |
browserify: | |
browserify -g deamdify lib/index.js --debug true --standalone __EXPORTS__ > dist/out.js | |
@@make test | |
test: | |
@@r.js loader.js | |
@echo " -- " | |
@@node dist/out.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment