Last active
June 6, 2017 22:26
-
-
Save grahamb/0fb48f42a871d6b2fff4ddd62aceb8a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ NODE_ENV=production webpack --env.prod | |
/Users/grahamb/code/sfu/snap/node_modules/loader-runner/lib/loadLoader.js:35 | |
throw new Error("Module '" + loader.path + "' is not a loader (must have normal or pitch function)"); | |
^ | |
Error: Module '/Users/grahamb/code/sfu/snap/node_modules/url/url.js' is not a loader (must have normal or pitch function) | |
at loadLoader (/Users/grahamb/code/sfu/snap/node_modules/loader-runner/lib/loadLoader.js:35:10) | |
at iteratePitchingLoaders (/Users/grahamb/code/sfu/snap/node_modules/loader-runner/lib/LoaderRunner.js:164:2) | |
at runLoaders (/Users/grahamb/code/sfu/snap/node_modules/loader-runner/lib/LoaderRunner.js:357:2) | |
at NormalModule.doBuild (/Users/grahamb/code/sfu/snap/node_modules/webpack/lib/NormalModule.js:129:2) | |
at NormalModule.build (/Users/grahamb/code/sfu/snap/node_modules/webpack/lib/NormalModule.js:180:15) | |
at Compilation.buildModule (/Users/grahamb/code/sfu/snap/node_modules/webpack/lib/Compilation.js:127:10) | |
at factoryCallback (/Users/grahamb/code/sfu/snap/node_modules/webpack/lib/Compilation.js:304:11) | |
at /Users/grahamb/code/sfu/snap/node_modules/webpack/lib/NormalModuleFactory.js:242:4 | |
at /Users/grahamb/code/sfu/snap/node_modules/webpack/lib/NormalModuleFactory.js:93:13 | |
at /Users/grahamb/code/sfu/snap/node_modules/tapable/lib/Tapable.js:204:11 | |
at NormalModuleFactory.<anonymous> (/Users/grahamb/code/sfu/snap/node_modules/webpack/lib/CompatibilityPlugin.js:51:4) | |
at NormalModuleFactory.applyPluginsAsyncWaterfall (/Users/grahamb/code/sfu/snap/node_modules/tapable/lib/Tapable.js:208:13) | |
at onDoneResolving (/Users/grahamb/code/sfu/snap/node_modules/webpack/lib/NormalModuleFactory.js:68:11) | |
at onDoneResolving (/Users/grahamb/code/sfu/snap/node_modules/webpack/lib/NormalModuleFactory.js:189:6) | |
at _combinedTickCallback (internal/process/next_tick.js:67:7) | |
at process._tickCallback (internal/process/next_tick.js:98:9) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "student-dashboard", | |
"version": "1.0.0", | |
"description": "SFU Student Dashboard application", | |
"main": "build/server/index.js", | |
"scripts": { | |
"prestart": "npm run prebuild && npm run generate-schema", | |
"start": "npm run prebuild && NODE_ENV=development DEBUG=snap:* nodemon --watch server -r babel-register -r ./environment.js server/index.js", | |
"start:inspect": "npm run prestart && NODE_ENV=development node --inspect -r babel-register -r ./environment.js server/index.js", | |
"start:production": "NODE_ENV=production node -r ./environment.js build/index.js", | |
"prebuild": "rimraf build public/assets", | |
"build": "NODE_ENV=production npm run lint && npm run generate-schema && npm run build:assets && npm run build:server", | |
"build:assets": "NODE_ENV=production webpack --env.prod", | |
"build:server": "babel server --out-dir build --ignore **/__test__/* --copy-files", | |
"lint": "eslint -c .eslintrc --ignore-pattern=build --ignore-pattern=public .", | |
"lint:fix": "npm run lint -- --fix", | |
"lint:changed": "./scripts/lint-changed.sh", | |
"validate-webpack": "npm run validate-webpack:dev && npm run validate-webpack:prod", | |
"validate-webpack:dev": "webpack-validator webpack.config.js --env.dev", | |
"validate-webpack:prod": "webpack-validator webpack.config.js --env.prod", | |
"test": "NODE_ENV=test ava -v -s --no-cache", | |
"test:watch": "npm run test -- -w", | |
"deps:reinstall": "rimraf node_modules && npm i --no-optional", | |
"db": "node -r ./environment.js node_modules/.bin/knex --knexfile ./server/db/knexfile.js --", | |
"db:migrate": "npm run db migrate:latest", | |
"db:migrate:rollback": "npm run db migrate:rollback", | |
"db:migrate:make": "npm run db migrate:make", | |
"db:init": "node -r babel-register -r ./environment.js ./server/db/init.js", | |
"db:init:test": "npm run db:init -- dotenv_config_path=./.env.test", | |
"generate-schema": "node -r ./environment.js ./scripts/buildSchema.js" | |
}, | |
"ava": { | |
"files": [ | |
"**/__test__/*.js" | |
], | |
"require": [ | |
"./environment.js", | |
"babel-register", | |
"./testHelperBrowserEnv.js" | |
], | |
"babel": "inherit" | |
}, | |
"repository": { | |
"type": "git", | |
"url": "git+https://github.com/sfu/student-dashboard.git" | |
}, | |
"author": "Graham Ballantyne <grahamb@sfu.ca>", | |
"license": "ISC", | |
"bugs": { | |
"url": "https://github.com/sfu/student-dashboard/issues" | |
}, | |
"homepage": "https://github.com/sfu/student-dashboard#readme", | |
"pre-commit": [ | |
"lint:changed" | |
], | |
"devDependencies": { | |
"autoprefixer": "^6.7.0", | |
"ava": "^0.17.0", | |
"babel-cli": "^6.22.2", | |
"babel-core": "^6.22.1", | |
"babel-eslint": "^7.1.1", | |
"babel-loader": "^6.2.10", | |
"babel-plugin-dedent": "2.0.0", | |
"babel-plugin-rewire": "^1.0.0", | |
"babel-plugin-transform-async-to-generator": "^6.22.0", | |
"babel-plugin-transform-class-properties": "^6.22.0", | |
"babel-plugin-transform-object-rest-spread": "^6.22.0", | |
"babel-polyfill": "^6.22.0", | |
"babel-preset-es2015": "^6.22.0", | |
"babel-preset-node6": "11.0.0", | |
"babel-preset-react": "^6.22.0", | |
"babel-register": "^6.22.0", | |
"browser-env": "^2.0.19", | |
"chalk": "1.1.3", | |
"chunk-manifest-webpack-plugin": "^1.0.0", | |
"css-loader": "^0.26.1", | |
"debug": "^2.6.0", | |
"eslint": "^3.14.1", | |
"eslint-import-resolver-webpack": "^0.8.1", | |
"eslint-plugin-import": "^2.2.0", | |
"eslint-plugin-jsx-a11y": "^3.0.2", | |
"eslint-plugin-react": "^6.9.0", | |
"extract-text-webpack-plugin": "2.0.0-beta.5", | |
"fakeredis": "1.0.3", | |
"file-loader": "0.9.0", | |
"html-loader": "0.4.4", | |
"html-webpack-plugin": "^2.26.0", | |
"html-webpack-template": "^6.0.0", | |
"mock-knex": "^0.3.7", | |
"nodemon": "1.11.0", | |
"pg-connection-string": "0.1.3", | |
"postcss-loader": "^1.2.2", | |
"postcss-modules-values": "1.2.2", | |
"pre-commit": "^1.2.2", | |
"react-hot-loader": "3.0.0-beta.2", | |
"rimraf": "2.5.4", | |
"sinon": "^1.17.7", | |
"sinon-express-mock": "1.2.4", | |
"style-loader": "0.13.1", | |
"svg-react-loader": "0.4.0-beta.2", | |
"url-loader": "0.5.7", | |
"webpack": "2.2.0", | |
"webpack-dev-middleware": "^1.9.0", | |
"webpack-hot-middleware": "^2.15.0", | |
"webpack-manifest-plugin": "^1.1.0", | |
"webpack-md5-hash": "^0.0.5", | |
"webpack-validator": "^2.3.0" | |
}, | |
"dependencies": { | |
"axios": "0.14.0", | |
"babel-relay-plugin": "0.9.2", | |
"body-parser": "1.15.2", | |
"cas": "github:grahamb/node-cas", | |
"classnames": "2.2.5", | |
"connect-redis": "3.1.0", | |
"cookie-parser": "1.4.3", | |
"date-fns": "^1.21.1", | |
"dotenv": "2.0.0", | |
"ejs": "^2.5.5", | |
"errorhandler": "1.4.3", | |
"express": "4.14.0", | |
"express-boom": "1.0.0", | |
"express-http-proxy": "^0.10.1", | |
"express-jsonschema": "^1.1.6", | |
"express-request-id": "^1.1.0", | |
"express-session": "1.14.1", | |
"graphiql": "0.7.8", | |
"graphql": "0.7.1", | |
"graphql-docs": "0.2.0", | |
"helmet": "2.3.0", | |
"jsonwebtoken": "7.1.9", | |
"knex": "0.12.2", | |
"leaflet": "^1.0.2", | |
"lodash": "^4.17.2", | |
"method-override": "^2.3.7", | |
"moment": "2.15.1", | |
"node-uuid": "1.4.7", | |
"normalize.css": "4.2.0", | |
"pg": "6.1.0", | |
"promise-redis": "^0.0.5", | |
"qs": "6.2.1", | |
"react": "15.3.2", | |
"react-barcode": "1.1.0", | |
"react-collapse": "^2.3.3", | |
"react-dom": "15.3.1", | |
"react-ga": "^2.1.2", | |
"react-height": "^2.1.1", | |
"react-leaflet": "^1.0.0", | |
"react-leaflet-control": "^1.2.0", | |
"react-motion": "^0.4.5", | |
"react-redux": "^4.4.6", | |
"react-relay": "0.9.2", | |
"react-router": "2.8.1", | |
"react-router-relay": "0.13.4", | |
"redis": "2.6.2", | |
"redux": "^3.6.0", | |
"redux-thunk": "^2.1.0", | |
"url": "0.11.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('./environment') | |
const {resolve} = require('path') | |
const webpack = require('webpack') | |
const HtmlWebpackPlugin = require('html-webpack-plugin') | |
const ExtractTextPlugin = require('extract-text-webpack-plugin') | |
const autoprefixer = require('autoprefixer') | |
const values = require('postcss-modules-values') | |
const htmlWebpackTemplate = require('html-webpack-template') | |
const ManifestPlugin = require('webpack-manifest-plugin') | |
const ChunkManifestPlugin = require('chunk-manifest-webpack-plugin') | |
const WebpackMd5Hash = require('webpack-md5-hash') | |
module.exports = (env = {}) => { | |
const addItem = (add, item) => add ? item : undefined | |
const ifProd = item => addItem(env.prod, item) | |
const ifDev = item => addItem(!env.prod, item) | |
const removeEmpty = array => array.filter(i => !!i) | |
const config = { | |
entry: { | |
app: removeEmpty([ | |
ifDev('react-hot-loader/patch'), | |
ifDev('webpack-hot-middleware/client?path=/__webpack_hmr'), | |
resolve(__dirname, 'client/index.js') | |
]), | |
vendor: [ | |
'react', | |
'react-dom', | |
'react-ga', | |
'react-relay', | |
'react-router', | |
'redux', | |
'react-redux', | |
'redux-thunk', | |
'moment' | |
], | |
graphiql: resolve(__dirname, 'graphiql/index.js') | |
}, | |
output: { | |
filename: env.prod ? '[name].[chunkhash].js' : '[name].js', | |
chunkFilename: env.prod ? '[name].[chunkhash].js' : '[name].js', | |
path: resolve(__dirname, 'public/assets'), | |
publicPath: '/assets/' | |
}, | |
devtool: env.prod ? 'source-map' : 'eval', | |
resolve: { | |
extensions: ['*', '.js', '.jsx'], | |
modules: [ | |
resolve(__dirname, 'client'), | |
resolve(__dirname, 'queries'), | |
resolve(__dirname, 'node_modules') | |
] | |
}, | |
resolveLoader: { | |
moduleExtensions: ['-loader'] | |
}, | |
module: { | |
loaders: removeEmpty([ | |
{ | |
test: /\.html$/, | |
loader: 'html-loader', | |
query: { | |
interpolate: true, | |
minimize: false | |
} | |
}, | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
loader: 'babel-loader', | |
query: { | |
plugins: removeEmpty([ | |
ifDev('react-hot-loader/babel'), | |
resolve(__dirname, './babelRelayPlugin.js'), | |
'transform-class-properties', | |
'transform-object-rest-spread' | |
]), | |
presets: [ | |
['es2015', {modules: false}], | |
'react' | |
], | |
babelrc: false | |
} | |
}, | |
{ | |
test: /\.(png)$/, | |
loader: 'url-loader' | |
}, | |
{ | |
test: /\.svg$/, | |
loader: 'babel-loader?presets[]=es2015,presets[]=react!svg-react' | |
}, | |
ifProd({ | |
test: /node_modules\/graphiql\/graphiql\.css$/, | |
loader: ExtractTextPlugin.extract({ | |
fallbackLoader: 'style-loader', | |
loader: 'css-loader' | |
}) | |
}), | |
ifDev({ | |
test: /node_modules\/graphiql\/graphiql\.css$/, | |
loaders: [ | |
'file-loader?name=[name].[ext]' | |
] | |
}), | |
ifProd({ | |
test: /\.css$/, | |
exclude: [/graphiql\.css$/], | |
loader: ExtractTextPlugin.extract({ | |
fallbackLoader: 'style-loader', | |
loader: 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]' | |
}) | |
}), | |
ifDev({ | |
test: /\.css$/, | |
exclude: [/graphiql\.css$/], | |
loaders: [ | |
'style-loader?sourceMap', | |
'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]', | |
{ | |
loader: 'postcss-loader', | |
options: { | |
plugins: () => [values, autoprefixer] | |
} | |
} | |
] | |
}) | |
]) | |
}, | |
plugins: removeEmpty([ | |
new WebpackMd5Hash(), | |
new ChunkManifestPlugin({ | |
filename: 'chunk-manifest.json', | |
manifestVariable: "webpackManifest" | |
}), | |
new ManifestPlugin({ | |
fileName: 'manifest.json', | |
basePath: '/assets/', | |
writeToFileEmit: true | |
}), | |
new webpack.IgnorePlugin(/^\.\/locale$/, [/moment$/]), | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: 'vendor', | |
filename: env.prod ? '[name].[chunkhash].js' : '[name].js', | |
chunks: 'app' | |
}), | |
ifDev(new webpack.HotModuleReplacementPlugin()), | |
ifProd(new webpack.LoaderOptionsPlugin({ | |
minimize: true, | |
debug: false, | |
quiet: true | |
})), | |
ifProd(new webpack.optimize.UglifyJsPlugin({ | |
sourceMap: true, | |
compress: { | |
warnings: false, | |
screw_ie8: true | |
} | |
})), | |
ifProd(new ExtractTextPlugin('[name].[chunkhash].css'), { | |
allChunks: false | |
}), | |
// GraphiQL HTML (graphiql.html) | |
new HtmlWebpackPlugin({ | |
inject: false, | |
template: htmlWebpackTemplate, | |
title: 'SFU Snap - API Explorer', | |
appMountId: 'graphiql', | |
links: ['/assets/graphiql.css'], | |
chunks: [ 'vendor', 'graphiql' ], | |
hash: true, | |
filename: resolve(__dirname, 'public/assets/graphiql.html') | |
}), | |
new webpack.DefinePlugin({ | |
'process.env': { | |
NODE_ENV: env.prod ? '"production"' : '"development"', | |
GRAPHQL_SERVER: JSON.stringify(process.env.GRAPHQL_SERVER), | |
ROOMFINDER_URL: JSON.stringify(process.env.ROOMFINDER_URL || 'https://its-arcgis-web.its.sfu.ca/apps/sfuroomfinder_ios/'), | |
MAPBOX_TILES_URL: JSON.stringify(process.env.MAPBOX_TILES_URL), | |
GOOGLE_ANALYTICS_CODE: JSON.stringify(process.env.GOOGLE_ANALYTICS_CODE), | |
BUILD: JSON.stringify(process.env.BUILD) || undefined | |
} | |
}) | |
]) | |
} | |
return config | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment