Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import * as ExtractTextPlugin from 'extract-text-webpack-plugin';
- import * as path from 'path';
- import {Configuration, DefinePlugin} from 'webpack';
- const SpriteLoaderPlugin = require('svg-sprite-loader/plugin');
- const config: Configuration = {
- mode: 'development',
- watch: true,
- entry: ['./assets/scripts/index.ts', './assets/styles/index.scss', './assets/sprite/sprite.js'],
- output: {
- filename: 'script.js',
- path: path.join(__dirname, 'static')
- },
- devtool: 'source-map',
- resolve: {
- extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js']
- },
- module: {
- rules: [
- {
- test: /\.tsx?$/,
- exclude: ['/node_modules/'],
- use: [{
- loader: 'awesome-typescript-loader',
- options: {
- configFileName: 'tsconfig.json'
- }
- }]
- }, {
- test: /\.scss$/,
- exclude: ['/node_modules/'],
- use: ExtractTextPlugin.extract({
- fallback: 'style-loader',
- use: [{
- loader: 'css-loader'
- }, {
- loader: 'sass-loader',
- options: {
- sourceMap: true
- }
- }]
- })
- }, {
- test: /\.svg$/,
- include: [path.join(__dirname, 'assets/sprite')],
- use: [{
- loader: 'svg-sprite-loader',
- options: {
- extract: true,
- spriteFilename: 'sprite.svg'
- }
- }],
- }
- ]
- },
- plugins: [
- new ExtractTextPlugin({
- filename: 'style.css'
- }),
- new SpriteLoaderPlugin(),
- new DefinePlugin({
- 'process.env': {
- NODE_ENV: JSON.stringify('development'),
- }
- })
- ]
- };
- export = config;
Add Comment
Please, Sign In to add comment