const webpack = require('webpack');
const path = require('path');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');

module.exports = {
	mode: 'development',
	devtool: "source-map",
	entry: {
    'bundle': path.resolve(__dirname, "./src/main.js"),
	},
	output: {
		path: path.resolve(__dirname, './dist/'),
		filename: 'stepform.js'
	},
	module: {
		rules: [
			{
				test: /\.js$/,
				loader: 'babel-loader',
				options: {
					presets: [
						'@babel/preset-env',
					],
				},
			},
			{
				test: /\.scss$/,
				use: [
            "style-loader",
					{
						loader: 'css-loader',
						options: {
						url: false,
						sourceMap: true,
						importLoaders: 2
					},
				},
				{
					loader: 'sass-loader',
					options: {
						sourceMap: true,
					}
				},
        ]
			}
		]
	},
	target: ['web', 'es5'],
    plugins: [
			new BrowserSyncPlugin({
				host: 'localhost',
				port: 3000,
				proxy: "http://localhost:8000"
			})
    ],
    watchOptions: {
        ignored: /node_modules/
    }
}