您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

common.js 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. performance: {
  73. hints: 'warning',
  74. maxAssetSize: 30000000,
  75. maxEntrypointSize: 50000000
  76. },
  77. plugins: [
  78. new webpack.DefinePlugin({
  79. __VERSION__: JSON.stringify(packageInfo.version),
  80. __TIME__: JSON.stringify(getTime()),
  81. __AUTHOR__: JSON.stringify(packageInfo.author),
  82. __REPOSITORY__: JSON.stringify(packageInfo.repository),
  83. __HOME_PAGE__: JSON.stringify(packageInfo.homepage)
  84. })
  85. ]
  86. }