Created
August 31, 2015 08:33
-
-
Save XOP/2197216adaf8c1335afd to your computer and use it in GitHub Desktop.
Include zepto in webpack bundle
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
/** | |
* App | |
*/ | |
// | |
// only relevant code! | |
// | |
var $ = require('zepto'); | |
// | |
// other code | |
// |
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
/** | |
* Module | |
*/ | |
// | |
// code example | |
// using zepto | |
$.extend({}, foobar, {foo : bar}); |
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
var webpack = require('webpack'); | |
var path = require('path'); | |
// | |
// only relevant config! | |
// | |
var config = { | |
addVendor: function (name, path) { | |
this.resolve.alias[name] = path; | |
this.module.noParse.push(new RegExp(path)); | |
}, | |
resolve: { | |
alias: {} | |
}, | |
module: { | |
noParse: [], | |
preLoaders: [ | |
{test: /zepto\.min\.js$/, loader: "script-loader"} | |
] | |
} | |
}; | |
config.addVendor('zepto', 'zepto/zepto.min.js'); | |
module.exports = config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment