webpack.config.js 948 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 'use strict'
  2. const fs = require('fs');
  3. const path = require('path');
  4. const webpack = require('webpack');
  5. const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
  6. const version = require('../package.json').version;
  7. const license = require('./license-template');
  8. const header = `
  9. /*!
  10. @fileoverview gl-matrix - High performance matrix and vector operations
  11. @author Brandon Jones
  12. @author Colin MacKenzie IV
  13. @version ${version}
  14. ${license}
  15. */`;
  16. module.exports = {
  17. entry: path.join(process.cwd(), 'src/gl-matrix.js'),
  18. mode: 'production',
  19. output: {
  20. path: path.join(process.cwd(), 'dist'),
  21. filename: 'gl-matrix.js',
  22. libraryTarget: 'umd',
  23. globalObject: 'typeof self !== \'undefined\' ? self : this'
  24. },
  25. module: {
  26. rules: [{
  27. test: path.join(process.cwd(), 'src'),
  28. exclude: /node_modules/,
  29. loader: 'babel-loader',
  30. }]
  31. },
  32. plugins: [
  33. new webpack.BannerPlugin({ banner: header, raw: true }),
  34. ]
  35. };