webpack.gradient.config.js 1.6 KB

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