Guest User

Untitled

a guest
Jan 24th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. const path = require('path');
  2.  
  3. const isDev = process.argv.find(arg => arg.includes('webpack-dev-server'));
  4. const outputPath = path.join(__dirname, '..', isDev ? 'src' : 'dist');
  5.  
  6. module.exports = {
  7. entry: './src/index.js',
  8. devtool: 'cheap-module-source-map',
  9. cache: true,
  10. output: {
  11. path: outputPath,
  12. filename: 'bundle.js'
  13. },
  14. module: {
  15. rules: [
  16. {
  17. test: /\.js$/,
  18. // We need to transpile Polymer itself and other ES6 code
  19. // exclude: /(node_modules)/,
  20. use: 'babel-loader'
  21. },
  22. {
  23. test: /\.html$/,
  24. use: ['text-loader', 'postcss-html-loader']
  25. },
  26. {
  27. test: /\.postcss$/,
  28. use: ['text-loader', 'postcss-loader']
  29. }
  30. ]
  31. },
  32. resolve: {
  33. alias: {
  34. '@demo/decorators': path.resolve(__dirname, '..', 'decorators')
  35. }
  36. },
  37. devServer: {
  38. contentBase: [outputPath, path.resolve(__dirname, '..', 'node_modules')],
  39. compress: true,
  40. overlay: {
  41. errors: true
  42. },
  43. port: 3000
  44. }
  45. };
Add Comment
Please, Sign In to add comment