fix fetch example scripts, add webpack config to build fetch script bundles
This commit is contained in:
parent
93e4052101
commit
6ecfe64485
7 changed files with 95 additions and 2 deletions
|
@ -12,8 +12,8 @@
|
|||
"build:client": "cross-env NODE_ENV=production webpack --config webpack.config.prod.js --progress",
|
||||
"build:server": "cross-env NODE_ENV=production webpack --config webpack.config.server.js --progress",
|
||||
"test": "npm run lint",
|
||||
"fetch-examples": "node scripts/fetch-examples.js",
|
||||
"fetch-examples-gg": "node scripts/fetch-examples-gg.js"
|
||||
"fetch-examples": "node ./server/scripts/fetch-examples.js",
|
||||
"fetch-examples-gg": "node ./server/scripts/fetch-examples-gg.js"
|
||||
},
|
||||
"main": "index.js",
|
||||
"author": "Cassie Tarakajian",
|
||||
|
|
93
webpack.config.examples.js
Normal file
93
webpack.config.examples.js
Normal file
|
@ -0,0 +1,93 @@
|
|||
const path = require('path');
|
||||
const nodeExternals = require('webpack-node-externals');
|
||||
|
||||
module.exports = [{
|
||||
entry: path.resolve(__dirname, 'server/scripts/fetch-examples.js'),
|
||||
|
||||
output: {
|
||||
path: __dirname + '/dist/',
|
||||
filename: 'fetch-examples.bundle.js'
|
||||
},
|
||||
|
||||
target: 'node',
|
||||
|
||||
externals: [nodeExternals()],
|
||||
|
||||
resolve: {
|
||||
extensions: ['*', '.js', '.jsx'],
|
||||
modules: [
|
||||
'client',
|
||||
'node_modules',
|
||||
],
|
||||
},
|
||||
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader',
|
||||
query: {
|
||||
presets: [
|
||||
'react',
|
||||
'env',
|
||||
'stage-0',
|
||||
],
|
||||
plugins: [
|
||||
[
|
||||
'babel-plugin-webpack-loaders', {
|
||||
'config': './webpack.config.babel.js',
|
||||
"verbose": false
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
entry: path.resolve(__dirname, 'server/scripts/fetch-examples-gg.js'),
|
||||
|
||||
output: {
|
||||
path: __dirname + '/dist/',
|
||||
filename: 'fetch-examples-gg.bundle.js'
|
||||
},
|
||||
|
||||
target: 'node',
|
||||
|
||||
externals: [nodeExternals()],
|
||||
|
||||
resolve: {
|
||||
extensions: ['*', '.js', '.jsx'],
|
||||
modules: [
|
||||
'client',
|
||||
'node_modules',
|
||||
],
|
||||
},
|
||||
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader',
|
||||
query: {
|
||||
presets: [
|
||||
'react',
|
||||
'env',
|
||||
'stage-0',
|
||||
],
|
||||
plugins: [
|
||||
[
|
||||
'babel-plugin-webpack-loaders', {
|
||||
'config': './webpack.config.babel.js',
|
||||
"verbose": false
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
}
|
||||
],
|
||||
},
|
||||
}];
|
Loading…
Reference in a new issue