Skip to content

Instantly share code, notes, and snippets.

@mwistrand
Created January 11, 2018 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mwistrand/aec18a21ecce4d6cebd85351b103e428 to your computer and use it in GitHub Desktop.
Save mwistrand/aec18a21ecce4d6cebd85351b103e428 to your computer and use it in GitHub Desktop.
Webpack config with external AMD module
const CleanWebpackPlugin = require('clean-webpack-plugin');
const HtmlPlugin = require('html-webpack-plugin');
const path = require('path');
const basePath = process.cwd();
module.exports = (env) => {
return {
externals: [
function (context, request, callback) {
if (request === 'some/amd/dep') {
return callback(null, 'amd some/amd/dep');
}
callback();
}
],
entry: {
main: './src/main'
},
output: {
path: path.resolve(basePath, 'dist'),
filename: '[name].js',
libraryTarget: 'umd'
},
resolve: {
modules: [ 'node_modules' ]
},
plugins: [
new CleanWebpackPlugin([ 'dist' ]),
new HtmlPlugin({
title: 'Sandbox'
})
]
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment