You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /**
  2. * @Author: Caven
  3. * @Date: 2021-03-13 12:09:44
  4. */
  5. 'use strict'
  6. const path = require('path')
  7. const webpack = require('webpack')
  8. const packageInfo = require('../package.json')
  9. const MiniCssExtractPlugin = require('mini-css-extract-plugin')
  10. function getTime() {
  11. let now = new Date()
  12. let m = now.getMonth() + 1
  13. m = m < 10 ? '0' + m : m
  14. let d = now.getDate()
  15. d = d < 10 ? '0' + d : d
  16. return `${now.getFullYear()}-${m}-${d}`
  17. }
  18. module.exports = {
  19. rules: [
  20. {
  21. test: /\.js$/,
  22. include: [
  23. path.resolve(__dirname, '../node_modules/cesium'),
  24. path.resolve(__dirname, '../libs'),
  25. path.resolve(__dirname, '../modules'),
  26. path.resolve(__dirname, '../packages')
  27. ],
  28. loader: 'babel-loader',
  29. options: {
  30. presets: ['@babel/preset-env'],
  31. plugins: ['@babel/transform-runtime'],
  32. compact: false,
  33. ignore: ['checkTree']
  34. }
  35. },
  36. {
  37. test: /\.css$/,
  38. use: [
  39. MiniCssExtractPlugin.loader,
  40. {
  41. loader: 'css-loader'
  42. },
  43. {
  44. loader: 'sass-loader'
  45. }
  46. ]
  47. },
  48. {
  49. test: /\.scss$/,
  50. use: [
  51. MiniCssExtractPlugin.loader,
  52. {
  53. loader: 'css-loader'
  54. },
  55. {
  56. loader: 'sass-loader'
  57. }
  58. ]
  59. },
  60. {
  61. test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
  62. loader: 'url-loader',
  63. options: {
  64. limit: 20000
  65. }
  66. },
  67. {
  68. test: /\.glsl$/,
  69. loader: 'webpack-glsl-loader'
  70. }
  71. ],
  72. plugins: [
  73. new webpack.DefinePlugin({
  74. __VERSION__: JSON.stringify(packageInfo.version),
  75. __TIME__: JSON.stringify(getTime()),
  76. __AUTHOR__: JSON.stringify(packageInfo.author),
  77. __REPOSITORY__: JSON.stringify(packageInfo.repository),
  78. __HOME_PAGE__: JSON.stringify(packageInfo.homepage)
  79. })
  80. ]
  81. }