webpack.config.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. 'use strict';
  2. let webpack = require('webpack');
  3. let postcss_cssnext = require('postcss-cssnext');
  4. let path = require('path');
  5. function _path(p) {
  6. return path.join(__dirname, p);
  7. }
  8. module.exports = {
  9. entry: "./app.js",
  10. output: {
  11. path: __dirname,
  12. filename: "build/bundle.js"
  13. },
  14. module: {
  15. preLoaders: [
  16. {
  17. test: /\.js$/,
  18. loader: 'source-map',
  19. },
  20. ],
  21. loaders: [
  22. {
  23. test: /\.js$/,
  24. loader: 'babel',
  25. exclude: /(node_modules)/,
  26. query: {
  27. presets: [
  28. 'es2015',
  29. 'stage-0',
  30. ],
  31. passPerPreset: true,
  32. },
  33. },
  34. {
  35. test: /\.css$/,
  36. loader: 'style!css?importLoaders=1!postcss',
  37. },
  38. ]
  39. },
  40. postcss: [postcss_cssnext],
  41. resolve: {
  42. alias: {
  43. }
  44. },
  45. plugins: [
  46. new webpack.SourceMapDevToolPlugin(
  47. '[file].map', null,
  48. '[absolute-resource-path]',
  49. '[absolute-resource-path]'
  50. ),
  51. ],
  52. bail: true,
  53. debug: true,
  54. devServer: {
  55. publicPath: '/',
  56. outputPath: _path('build'),
  57. stats: {colors: true},
  58. host: '0.0.0.0',
  59. inline: true,
  60. port: '8080',
  61. quiet: false,
  62. noInfo: false,
  63. },
  64. };