Skip to content

Instantly share code, notes, and snippets.

@victorkurauchi
Last active December 29, 2018 11:03
Show Gist options
  • Save victorkurauchi/b8cdd8e96277242232023ee54bd4333a to your computer and use it in GitHub Desktop.
Save victorkurauchi/b8cdd8e96277242232023ee54bd4333a to your computer and use it in GitHub Desktop.
webpack.config.js
const path = require('path');
const mode = process.env.NODE_ENV === 'dev' || process.env.NODE_ENV === 'test' ? 'development' : 'production';
module.exports = {
target: 'node',
mode: mode,
entry: __dirname + '/src/index.js',
devtool: 'inline-source-map',
resolve: {
extensions: [ '.js' ]
},
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
},
output: {
filename: 'weather.js',
path: path.resolve(__dirname, 'dist'),
library: 'weather',
libraryTarget: 'umd',
globalObject: 'typeof self !== \'undefined\' ? self : this'
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment