mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 06:27:19 +01:00
add preact with webpack
This commit is contained in:
47
config/setup.js
Normal file
47
config/setup.js
Normal file
@@ -0,0 +1,47 @@
|
||||
const { join } = require('path');
|
||||
const webpack = require('webpack');
|
||||
const Dashboard = require('webpack-dashboard/plugin');
|
||||
const Clean = require('clean-webpack-plugin');
|
||||
const Copy = require('copy-webpack-plugin');
|
||||
const HTML = require('html-webpack-plugin');
|
||||
|
||||
const uglify = require('./uglify');
|
||||
const babel = require('./babel');
|
||||
|
||||
const root = join(__dirname, '..');
|
||||
|
||||
module.exports = isProd => {
|
||||
// base plugins array
|
||||
const plugins = [
|
||||
new Clean(['dist'], { root }),
|
||||
new Copy([{ context: 'webapp/static/', from: '**/*.*' }]),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': JSON.stringify(isProd ? 'production' : 'development')
|
||||
}),
|
||||
new HTML({ template: 'webapp/index.html' }),
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
options: {
|
||||
babel
|
||||
}
|
||||
})
|
||||
];
|
||||
|
||||
if (isProd) {
|
||||
plugins.push(
|
||||
new webpack.LoaderOptionsPlugin({ minimize: true, debug: false }),
|
||||
new webpack.optimize.UglifyJsPlugin(uglify)
|
||||
);
|
||||
} else {
|
||||
// dev only
|
||||
plugins.push(
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new webpack.NamedModulesPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
__DEVELOPMENT__: !isProd
|
||||
}),
|
||||
new Dashboard()
|
||||
);
|
||||
}
|
||||
|
||||
return plugins;
|
||||
};
|
||||
Reference in New Issue
Block a user