mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-08-19 23:12:21 +02:00
new section
This commit is contained in:
@@ -1,12 +1,21 @@
|
||||
var webpack = require('webpack');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
// see http://jlongster.com/Backend-Apps-with-Webpack--Part-I
|
||||
var externals = false;
|
||||
|
||||
// Bundle entry point
|
||||
var entry = ['./components/App.jsx'];
|
||||
|
||||
// However, do we want one full page, or single pages with react-router?
|
||||
if(process.argv.indexOf("--singles") !== -1 ) {
|
||||
entry = ['./pages/Routed.jsx'];
|
||||
}
|
||||
// Bundle target
|
||||
var target = "web";
|
||||
|
||||
// Bundle output
|
||||
var output = {
|
||||
path: __dirname,
|
||||
filename: 'article.js'
|
||||
};
|
||||
|
||||
// Necessary webpack loaders for converting our content:
|
||||
var webpackLoaders = [
|
||||
@@ -32,21 +41,52 @@ else if(process.argv.indexOf("--prod") > -1) {
|
||||
plugins.push(new webpack.optimize.UglifyJsPlugin());
|
||||
}
|
||||
|
||||
// However, do we want one full page, or single pages with react-router?
|
||||
if(process.argv.indexOf("--singles") !== -1 ) {
|
||||
entry = ['./lib/site/routemap.js'];
|
||||
|
||||
target = "node";
|
||||
|
||||
output = {
|
||||
path: output.path + '/pages',
|
||||
filename: "routemap.js",
|
||||
library: "routemap",
|
||||
libraryTarget: "commonjs2"
|
||||
};
|
||||
|
||||
console.log("\n","marking node_modules as external","\n");
|
||||
externals = {};
|
||||
fs.readdirSync('node_modules')
|
||||
.filter(function(x) { return ['.bin'].indexOf(x) === -1; })
|
||||
.forEach(function(mod) { externals[mod] = 'commonjs ' + mod; });
|
||||
plugins.pop();
|
||||
}
|
||||
|
||||
// And the final config that webpack will read in.
|
||||
module.exports = {
|
||||
entry: entry,
|
||||
output: {
|
||||
path: __dirname,
|
||||
filename: 'article.js'
|
||||
},
|
||||
target: target,
|
||||
output: output,
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.(png|gif)$/, loader: "file?name=images/packed/[hash].[ext]" },
|
||||
{ test: /\.less$/, loader: "style!css!less" },
|
||||
{ test: /\.json$/, loader: "json" },
|
||||
{
|
||||
test: /\.(png|gif)$/,
|
||||
loader: "file?name=images/packed/[hash].[ext]"
|
||||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
loader: "style!css!less"
|
||||
},
|
||||
{
|
||||
test: /\.json$/,
|
||||
loader: "json"
|
||||
},
|
||||
{
|
||||
test: /.jsx?$/,
|
||||
include: /(components|pages)/,
|
||||
include: [
|
||||
/components/,
|
||||
/lib.site/
|
||||
],
|
||||
loaders: webpackLoaders
|
||||
}
|
||||
]
|
||||
@@ -54,5 +94,6 @@ module.exports = {
|
||||
plugins: plugins,
|
||||
eslint: {
|
||||
configFile: __dirname + '/.eslintrc'
|
||||
}
|
||||
},
|
||||
externals: externals
|
||||
};
|
||||
|
Reference in New Issue
Block a user