webpack.config.js 601 B

12345678910111213141516171819202122232425
  1. var path = require('path')
  2. var webpack = require('webpack')
  3. var pkg = require('./package.json')
  4. var banner = 'lowdb v' + pkg.version
  5. module.exports = {
  6. entry: {
  7. low: './src/main.js',
  8. LocalStorage: './src/adapters/LocalStorage'
  9. },
  10. output: {
  11. path: path.resolve(__dirname, 'dist'),
  12. filename: process.argv.indexOf('-p') !== -1 ? '[name].min.js' : '[name].js',
  13. library: '[name]'
  14. },
  15. externals: {
  16. lodash: '_'
  17. },
  18. plugins: [new webpack.BannerPlugin(banner)],
  19. module: {
  20. loaders: [
  21. { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' }
  22. ]
  23. }
  24. }