-
-
Save Olegas/26d059a9b16514828b3a 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
define(['cjs'], function (cjs) { | |
console.log('amd module loaded'); | |
console.log('cjs exported:', cjs); | |
return 'AMD'; | |
}); |
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
define([], function () { | |
console.log('This module has been loaded asynchronously'); | |
return 'ASYNC'; | |
}); |
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
console.log('cjs module loaded'); | |
module.exports = 'CJS'; |
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 amd = require('amd'); | |
console.log('this is main.js'); | |
console.log('amd module exported:', amd); | |
setTimeout(function () { | |
// NOT A WEBPACK LOADER! | |
require(['myCustomRJSPlugin!async'], function (async) { | |
console.log('async module returned:', async); | |
}); | |
}, 5000); |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Webpack demo</title> | |
</head> | |
<body> | |
<h1>Webpack demo</h1> | |
<script src="bundle.js"></script> | |
</body> | |
</html> |
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.exports = { | |
entry: 'main.js', | |
output: { | |
filename: 'bundle.js' | |
}, | |
resolve: { | |
root: [ | |
__dirname | |
], | |
extensions: ['', '.js'] | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment