joyce/webpack.common.js

72 lines
1.3 KiB
JavaScript
Raw Normal View History

const webpack = require('webpack')
const path = require('path')
2018-11-27 08:02:24 +00:00
const ManifestPlugin = require('webpack-manifest-plugin')
const rootAssetPath = './src/'
module.exports = {
entry: {
joyce: [
rootAssetPath + 'joyce',
rootAssetPath + 'stylesheets/' + 'joyce.scss'
]
},
2018-11-27 06:59:02 +00:00
output: {
publicPath: "/static/js/",
2018-11-27 08:02:24 +00:00
filename: '[name].[hash].js',
2018-11-27 06:59:02 +00:00
path: path.resolve(__dirname, 'static/js/')
},
module : {
rules: [
{
test: /\.(js)$/,
2018-04-19 23:45:43 +00:00
exclude: [
/node_modules/,
/\.DS_Store/
2018-04-19 23:45:43 +00:00
],
use: {
loader: 'babel-loader',
options: {
presets: ['env', 'react']
}
}
},
{
test: /\.(png)$/,
use: {
loader: 'file-loader'
}
},
{
test: /\.(scss)$/,
2018-04-19 23:45:43 +00:00
exclude: [
/node_modules/,
/\.DS_Store/
2018-04-19 23:45:43 +00:00
],
use: [{
2018-04-19 23:45:43 +00:00
loader: 'style-loader',
}, {
2018-04-19 23:45:43 +00:00
loader: 'css-loader',
}, {
2018-04-19 23:45:43 +00:00
loader: 'postcss-loader',
options: {
plugins: [
require('precss'),
require('autoprefixer')
]
}
}, {
2018-11-27 06:59:02 +00:00
loader: 'sass-loader'
}]
},
{
2018-04-19 23:45:43 +00:00
test: /.(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,
use: [{
loader: 'file-loader'
}]
}
]},
2018-11-27 08:02:24 +00:00
plugins: [
new ManifestPlugin()
]
};