mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 14:37:21 +01:00
add preact with webpack
This commit is contained in:
46
config/webpack.js
Normal file
46
config/webpack.js
Normal file
@@ -0,0 +1,46 @@
|
||||
const { join } = require('path');
|
||||
const setup = require('./setup');
|
||||
|
||||
const dist = join(__dirname, '../dist');
|
||||
const exclude = /node_modules/;
|
||||
|
||||
module.exports = env => {
|
||||
const isProd = env && env.production;
|
||||
|
||||
return {
|
||||
entry: {
|
||||
app: './webapp/index.js',
|
||||
vendor: [
|
||||
'preact'
|
||||
]
|
||||
},
|
||||
output: {
|
||||
path: dist,
|
||||
filename: '[name].[hash].js',
|
||||
publicPath: '/'
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'react': 'preact/aliases',
|
||||
'react-dom': 'preact/aliases'
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
test: /\.jsx?$/,
|
||||
exclude: exclude,
|
||||
loader: 'babel-loader'
|
||||
}]
|
||||
},
|
||||
plugins: setup(isProd),
|
||||
devtool: !isProd && 'source-map',
|
||||
devServer: {
|
||||
contentBase: dist,
|
||||
port: process.env.PORT || 5050,
|
||||
historyApiFallback: true,
|
||||
compress: isProd,
|
||||
inline: !isProd,
|
||||
hot: !isProd
|
||||
}
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user