Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const path = require('path');
- //const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
- const MiniCssExtractPlugin = require('mini-css-extract-plugin');
- const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
- const { CleanWebpackPlugin } = require('clean-webpack-plugin');
- const SpriteLoaderPlugin = require('svg-sprite-loader/plugin');
- const glob = require('glob').sync;
- module.exports = env => {
- return {
- entry: {
- main: './main.js',
- [env.NODE_ENV]: `./scss/${env.NODE_ENV}.scss`,
- sprites: glob(`./svg/*.svg`)
- },
- output: {
- filename: '[name].js',
- path: path.resolve(__dirname, '../Synoptik.Intranet/static/js'),
- publicPath: 'http://dev.synoptik.intranet.no/static/js/'
- },
- devtool: 'inline-source-map',
- module: {
- rules: [
- {
- test: /\.(js|jsx)$/,
- exclude: /node_modules/,
- use: {
- loader: 'babel-loader'
- }
- },
- {
- test: /\.scss$/,
- use: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader']
- },
- {
- test: /\.svg$/,
- use: [
- {
- loader: 'svg-sprite-loader',
- options: {
- symbolId: '[name]',
- extract: true,
- spriteFilename: '../svg/sprites.svg'
- }
- },
- 'svgo-loader'
- ]
- }
- ]
- },
- resolve: {
- extensions: ['.js', '.jsx'],
- alias: {
- 'react-dom': '@hot-loader/react-dom'
- }
- },
- plugins: [
- //new BundleAnalyzerPlugin(),
- new SpriteLoaderPlugin(),
- new MiniCssExtractPlugin({
- filename: '../css/[name].css'
- }),
- new CleanWebpackPlugin({
- verbose: true,
- cleanOnceBeforeBuildPatterns: ['**/*']
- }),
- new HardSourceWebpackPlugin()
- ],
- devServer: {
- proxy: {
- '/': 'http://dev.synoptik.intranet.no'
- },
- compress: false,
- disableHostCheck: true,
- hot: true,
- writeToDisk: true,
- sockPort: 8080
- //host: '0.0.0.0'
- }
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement