-
-
Save mwistrand/aec18a21ecce4d6cebd85351b103e428 to your computer and use it in GitHub Desktop.
Webpack config with external AMD module
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
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