설명 없음
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.

webpack.config.js 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. const path = require('path');
  2. const ProvidePlugin = require('webpack/lib/ProvidePlugin');
  3. const ExtractTextPlugin = require('extract-text-webpack-plugin');
  4. const isProd = process.env.NODE_ENV === 'production';
  5. let plugins = [
  6. new ProvidePlugin({
  7. $: 'jquery',
  8. jQuery: 'jquery',
  9. 'window.jQuery': 'jquery',
  10. Popper: ['popper.js', 'default'],
  11. }),
  12. new ExtractTextPlugin({
  13. filename: '[name]' + (isProd ? '.min' : '') + '.css',
  14. allChunks: true,
  15. }),
  16. ];
  17. module.exports = {
  18. entry: {
  19. 'select2-bootstrap4': [
  20. './src/layout.scss',
  21. ],
  22. },
  23. output: {
  24. path: path.resolve(__dirname, './dist'),
  25. filename: '[name].js',
  26. },
  27. module: {
  28. rules: [
  29. {
  30. test: /\.scss$/,
  31. use: ExtractTextPlugin.extract({
  32. fallback: 'style-loader',
  33. use: [
  34. {
  35. loader: 'css-loader',
  36. },
  37. {
  38. loader: 'postcss-loader',
  39. options: {
  40. plugins: () => {
  41. let plugins = [
  42. require('precss'), // bootstrap4 requires this
  43. require('autoprefixer')({ browsers: ['last 2 versions'] }),
  44. ];
  45. if (isProd) {
  46. plugins = plugins.concat([
  47. require('cssnano')({ preset: 'default' }),
  48. ])
  49. }
  50. return plugins;
  51. },
  52. },
  53. },
  54. {
  55. loader: 'sass-loader',
  56. },
  57. ],
  58. }),
  59. },
  60. ],
  61. },
  62. plugins: plugins,
  63. };