Guest User

Untitled

a guest
Jun 24th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. import * as ExtractTextPlugin from 'extract-text-webpack-plugin';
  2. import * as path from 'path';
  3. import {Configuration, DefinePlugin} from 'webpack';
  4.  
  5. const SpriteLoaderPlugin = require('svg-sprite-loader/plugin');
  6. const config: Configuration = {
  7. mode: 'development',
  8. watch: true,
  9. entry: ['./assets/scripts/index.ts', './assets/styles/index.scss', './assets/sprite/sprite.js'],
  10. output: {
  11. filename: 'script.js',
  12. path: path.join(__dirname, 'static')
  13. },
  14.  
  15. devtool: 'source-map',
  16.  
  17. resolve: {
  18. extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js']
  19. },
  20.  
  21. module: {
  22. rules: [
  23. {
  24. test: /\.tsx?$/,
  25. exclude: ['/node_modules/'],
  26. use: [{
  27. loader: 'awesome-typescript-loader',
  28. options: {
  29. configFileName: 'tsconfig.json'
  30. }
  31. }]
  32. }, {
  33. test: /\.scss$/,
  34. exclude: ['/node_modules/'],
  35. use: ExtractTextPlugin.extract({
  36. fallback: 'style-loader',
  37. use: [{
  38. loader: 'css-loader'
  39. }, {
  40. loader: 'sass-loader',
  41. options: {
  42. sourceMap: true
  43. }
  44. }]
  45. })
  46. }, {
  47. test: /\.svg$/,
  48. include: [path.join(__dirname, 'assets/sprite')],
  49. use: [{
  50. loader: 'svg-sprite-loader',
  51. options: {
  52. extract: true,
  53. spriteFilename: 'sprite.svg'
  54. }
  55. }],
  56. }
  57. ]
  58. },
  59.  
  60. plugins: [
  61. new ExtractTextPlugin({
  62. filename: 'style.css'
  63. }),
  64. new SpriteLoaderPlugin(),
  65. new DefinePlugin({
  66. 'process.env': {
  67. NODE_ENV: JSON.stringify('development'),
  68. }
  69. })
  70. ]
  71. };
  72.  
  73. export = config;
Add Comment
Please, Sign In to add comment