Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const path = require('path');
- module.exports = (env, argv) => ({
- entry: path.resolve(__dirname, 'src/scripts/index.js'),
- devServer: {
- contentBase: path.join(__dirname, '.'),
- compress: true,
- port: 8080
- },
- devtool: argv.mode === 'production' ? false : 'source-map',
- mode: argv.mode || 'development',
- output: {
- filename: 'bundle.js',
- path: path.resolve(__dirname, 'dist')
- },
- module: {
- rules: [
- {
- test: /\.js$/,
- exclude: /node_modules/,
- use: {
- loader: 'babel-loader',
- options: {
- presets: ['@babel/preset-env'],
- cacheDirectory: true
- },
- }
- },
- {
- test: /\.s?css$/,
- use: [
- 'style-loader',
- {
- loader: 'css-loader',
- options: {
- sourceMap: argv.mode !== 'production'
- }
- },
- {
- loader: 'postcss-loader',
- options: {
- ident: 'postcss',
- plugins: [
- require('autoprefixer'),
- ]
- }
- },
- 'sass-loader'
- ]
- },
- {
- test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/i,
- loader: 'url-loader',
- options: {
- limit: 1024,
- outputPath: 'assets',
- name: '[name].[ext]'
- }
- },
- ]
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement