This repository has been archived on 2022-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
teemant-old/webpack.config.js

51 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

2019-01-09 17:26:09 +00:00
'use strict'
2016-12-15 21:30:55 +00:00
2019-01-09 17:26:09 +00:00
const webpack = require('webpack')
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const glb = require(path.join(__dirname, 'globals'))
2016-12-15 21:30:55 +00:00
module.exports = (env, options) => {
return {
entry: {
main: './src/js/main'
},
output: {
path: path.join(__dirname, 'app', 'public'),
filename: '[name].js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: [ '@babel/preset-env' ]
}
2019-01-09 17:26:09 +00:00
}
}
]
},
plugins: [
new webpack.ProvidePlugin({
// Detect and inject
_: 'underscore'
}),
new HtmlWebpackPlugin({
template: 'src/document/index.html'
}),
new CopyWebpackPlugin([{
from: 'static',
to: 'static'
}]),
new webpack.DefinePlugin({
globalConfig: JSON.stringify(glb.client)
})
],
devtool: (options.mode === 'development' ? 'inline-source-map' : undefined)
}
2019-01-09 17:26:09 +00:00
}