Skip to content

Instantly share code, notes, and snippets.

@awareness481
Last active August 2, 2018 04:22
Show Gist options
  • Save awareness481/e868cf7c8f38a877bf626566b34f5923 to your computer and use it in GitHub Desktop.
Save awareness481/e868cf7c8f38a877bf626566b34f5923 to your computer and use it in GitHub Desktop.
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/app.js',
target: 'web',
node: {
fs: 'empty'
},
output: {
path: path.join(__dirname, 'public'),
filename: 'bundle.js',
publicPath: '/public/'
},
module: {
rules: [{
test: /\.(html)$/,
use: {
loader: 'html-loader',
options: {
attrs: [':data-src']
}
},
test: /\.js$/,
include: path.join(__dirname, 'src'),
exclude: [ /(node_modules|bower_components)/,
'./src/server.js',
'./src/srv-compiled.js'
],
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
}
}]
},
module: {
rules: [{
test: /\.scss$/,
use: [
"style-loader", // creates style nodes from JS strings
"css-loader", // translates CSS into CommonJS
"sass-loader" // compiles Sass to CSS
],
test: /\.(png|jpg|gif)$/,
use: [
{
loader: 'file-loader',
options: {
publicPath: '.',
}
}
],
}]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment