Skip to content

Instantly share code, notes, and snippets.

@micahlmartin
Created May 5, 2017 03:31
Show Gist options
  • Save micahlmartin/e55b2d90a0b6d3c8bf4feda41d28ce85 to your computer and use it in GitHub Desktop.
Save micahlmartin/e55b2d90a0b6d3c8bf4feda41d28ce85 to your computer and use it in GitHub Desktop.
{
"name": "project",
"browser": {
"fs": false
},
"version": "0.1.0",
"private": true,
"dependencies": {
"babel": "^6.23.0",
"babel-cli": "^6.24.0",
"babel-core": "^6.24.1",
"babel-plugin-css-modules-transform": "^1.2.7",
"babel-plugin-transform-assets": "^0.2.0",
"babel-plugin-transform-async-to-generator": "^6.22.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-require-ignore": "^0.1.0",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-register": "^6.24.0",
"body-parser": "^1.17.1",
"bootstrap": "^4.0.0-alpha.6",
"bson-ext": "^1.0.5",
"cookie-parser": "^1.4.3",
"credstash": "^1.0.42",
"deep-diff": "^0.3.4",
"dexie-mongoify": "github:keithnorm/dexie-mongoify",
"dexie-observable": "^1.0.0-beta.3",
"express": "^4.15.2",
"express-es6-template-engine": "^1.1.1",
"express-session": "^1.15.2",
"history": "^4.6.1",
"humps": "^2.0.0",
"isomorphic-fetch": "^2.2.1",
"lodash": "^4.17.4",
"mongodb": "^2.2.25",
"mongoose": "^4.9.3",
"mongoose-patch-history": "^1.1.6",
"nodecredstash": "^1.0.1",
"normalizr": "^3.2.2",
"object-hash": "^1.1.7",
"offline-plugin": "^4.6.2",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-intl": "^2.2.3",
"react-redux": "^5.0.3",
"react-router": "^4.0.0",
"react-router-dom": "^4.0.0",
"redux": "^3.6.0",
"redux-saga": "^0.14.4",
"universal-router": "^3.0.0",
"uuid": "^3.0.1"
},
"devDependencies": {
"babel-loader": "^7.0.0",
"babel-preset-stage-2": "^6.24.1",
"css-loader": "^0.28.0",
"extract-text-webpack-plugin": "^2.1.0",
"isomorphic-style-loader": "^2.0.0",
"migrate": "github:wesleytodd/node-migrate",
"node-sass": "^4.5.2",
"nodemon": "^1.11.0",
"react-scripts": "0.9.5",
"sass-loader": "^6.0.3",
"sw-precache-webpack-plugin": "^0.9.1",
"webpack": "^2.4.1",
"worker-loader": "^0.8.0"
}
}
console.log("Test");
require('./scss/_main.scss');
const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const paths = require('./config/paths');
const findCacheDir = require('find-cache-dir');
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
function ensureSlash(path, needsSlash) {
var hasSlash = path.endsWith('/');
if (hasSlash && !needsSlash) {
return path.substr(path, path.length - 1);
} else if (!hasSlash && needsSlash) {
return path + '/';
} else {
return path;
}
}
// We use "homepage" field to infer "public path" at which the app is served.
// Webpack needs to know it to put the right <script> hrefs into HTML even in
// single-page apps that may serve index.html for nested URLs like /todos/42.
// We can't use a relative path in HTML because we don't want to load something
// like /todos/42/static/js/bundle.7289d.js. We have to know the root.
var homepagePath = require(paths.appPackageJson).homepage;
var homepagePathname = homepagePath ? url.parse(homepagePath).pathname : '/';
// `publicUrl` is just like `publicPath`, but we will provide it to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing slash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz.
var publicUrl = ensureSlash(homepagePathname, false);
module.exports = {
entry: {
bundle: [
// './src/scss/_main.scss',
// 'babel-polyfill/lib/index',
'./src/index'
]
,
worker: [
'./src/app/worker'
]
},
output: {
path: paths.appBuild,
filename: 'static/js/[name].[hash:8].js',
chunkFilename: 'static/js/[name].[chunkhash:8].chunk.js',
publicPath: publicUrl,
},
resolve: {
alias: {
},
extensions: ['.js', '.json', '.jsx'],
modules: [
'node_modules',
path.resolve(__dirname, 'client'),
path.resolve(__dirname, 'node_modules/bootstrap/scss')
],
},
module: {
rules: [
// {
// enforce: 'pre',
// exclude: /node_modules/,
// test: /\.jsx$/,
// use: [
// { loader: "eslint-loader "}
// ]
// },
{
test: /\.(js|jsx)$/,
include: paths.appSrc,
use: [
{
loader: "babel-loader",
options: {
cacheDirectory: findCacheDir({
name: 'react-scripts'
}),
presets: ["react", "es2015", "stage-2"]
}
}
]
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
use: [
{ loader: "css-loader" },
{
loader: "sass-loader",
options: {
includePaths: [path.resolve(__dirname, 'node_modules/bootstrap/scss')]
}
}
],
fallback: "isomorphic-style-loader"
})
}
]
},
node: {
fs: "empty"
},
plugins: [
new webpack.LoaderOptionsPlugin({
debug: true
}),
new webpack.DefinePlugin({
'process.env': {
isBrowser: JSON.stringify(true)
}
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.ProvidePlugin({
React: 'react',
ReactDOM: 'react-dom',
}),
new ExtractTextPlugin('static/css/[name].[hash:8].css'),
new SWPrecacheWebpackPlugin(
{
cacheId: 'project',
maximumFileSizeToCacheInBytes: 4194304,
minify: true
}
)
],
devtool: 'eval',
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment