webpack.custom.config.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. const path = require('path');
  2. const webpack = require('webpack');
  3. const DtsBundleWebpack = require('dts-bundle-webpack');
  4. const CleanWebpackPlugin = require('clean-webpack-plugin');
  5. module.exports = {
  6. context: __dirname,
  7. entry: {
  8. 'babylonjs-materials': path.resolve(__dirname, './legacy-custom.ts'),
  9. },
  10. output: {
  11. path: path.resolve(__dirname, '../dist/preview release/materialsLibrary'),
  12. filename: 'babylon.customMaterial.min.js',
  13. libraryTarget: 'umd',
  14. library: {
  15. root: ["MATLIB"],
  16. amd: "babylonjs-materials",
  17. commonjs: "babylonjs-materials"
  18. },
  19. umdNamedDefine: true
  20. },
  21. resolve: {
  22. extensions: [".js", '.ts']
  23. },
  24. externals: {
  25. babylonjs: {
  26. root: "BABYLON",
  27. commonjs: "babylonjs",
  28. commonjs2: "babylonjs",
  29. amd: "babylonjs"
  30. }
  31. },
  32. devtool: "source-map",
  33. module: {
  34. rules: [{
  35. test: /\.tsx?$/,
  36. loader: "ts-loader",
  37. exclude: /node_modules/
  38. },
  39. {
  40. test: /\.fx$/,
  41. use: [{
  42. loader: path.resolve(__dirname, '../../Tools/WebpackShaderLoader/index.js')
  43. }]
  44. }]
  45. },
  46. mode: "production",
  47. devServer: {
  48. contentBase: path.join(__dirname, "dist"),
  49. compress: false,
  50. //open: true,
  51. port: 9000
  52. },
  53. plugins: [
  54. new webpack.WatchIgnorePlugin([
  55. /\.js$/,
  56. /\.d\.ts$/
  57. ])
  58. ],
  59. watchOptions: {
  60. ignored: [path.resolve(__dirname, './dist/**/*.*'), 'node_modules']
  61. }
  62. }