Skip to content

Instantly share code, notes, and snippets.

@aweiland
Created January 3, 2017 21:06
Show Gist options
  • Save aweiland/3bed54def4f3dde16454492c8d1ba554 to your computer and use it in GitHub Desktop.
Save aweiland/3bed54def4f3dde16454492c8d1ba554 to your computer and use it in GitHub Desktop.
Webpack error
{
"presets": ["es2015", "react", "stage-0"]
}
{
"name": "purehelium",
"version": "1.0.0",
"description": "Yay!",
"main": "index.js",
"scripts": {
"test": "karma start",
"update-typings": "typings ls | awk '$2 ~ /.+/ {print $2}' | xargs -I {} typings i dt~{} -SG",
"watch": "gulp watch",
"FIXFIX": "webpack --progress --profile --colors --display-error-details --display-cached"
},
"author": "",
"license": "ISC",
"dependencies": {
"bootstrap": "^4.0.0-alpha.5",
"es6-promise": "^3.2.1",
"expose-loader": "^0.7.1",
"font-awesome": "^4.6.3",
"holderjs": "^2.9.4",
"immutable": "^3.8.1",
"jquery": "^3.0.0",
"jquery-serializejson": "^2.6.2",
"react": "^15.4.1",
"react-dom": "^15.4.1",
"tether": "^1.3.7",
"whatwg-fetch": "^1.0.0"
},
"devDependencies": {
"@types/jquery": "^2.0.37",
"@types/react": "^0.14.55",
"@types/react-dom": "^0.14.20",
"@types/whatwg-fetch": "^0.0.33",
"babel-core": "^6.21.0",
"babel-loader": "^6.2.10",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-0": "^6.16.0",
"exports-loader": "^0.6.3",
"gulp": "^3.9.1",
"gulp-clean-css": "^2.0.12",
"gulp-concat": "^2.6.0",
"gulp-concat-css": "^2.3.0",
"gulp-rename": "^1.2.2",
"gulp-ruby-sass": "^2.0.6",
"gulp-uglify": "^2.0.0",
"imports-loader": "^0.6.5",
"install": "^0.8.1",
"npm": "^3.9.6",
"source-map-loader": "^0.1.5",
"ts-loader": "^0.8.2",
"typescript": "^2.0.10",
"webpack": "2.1.0-beta.25",
"webpack-vendor-chunk-plugin": "^1.0.0"
}
}
{
"compilerOptions": {
"module": "es6",
"target": "es6",
"moduleResolution": "node",
"baseUrl": "src",
"allowSyntheticDefaultImports": true,
"noImplicitAny": false,
"sourceMap": true,
"outDir": "build/ts",
"jsx": "preserve",
"types": [ "whatwg-fetch" ]
},
"exclude": [
"node_modules"
],
"includes": [
"js/**/*",
"@types/isomorphic-fetch/index.d.ts",
"interfaces.d.ts"
]
}
let webpack = require('webpack');
let VendorChunkPlugin = require('webpack-vendor-chunk-plugin');
let path = require('path');
let outpath = path.resolve(__dirname, "../resources/static/js");
module.exports = {
entry: {
app: ["./app/js/App.ts", "./app/js/CalendarEditor.tsx", "./app/js/RecipeControls.tsx"],
vendor: ['react', 'react-dom', 'whatwg-fetch', 'es6-promise']
},
output: {
filename: "[name].bundle.js",
path: outpath
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: "vendor",
filename: 'vendor.js',
path: outpath,
minChunks: Infinity
}),
new VendorChunkPlugin('vendor'),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
//"window.jQuery": "jquery",
'Promise': 'es6-promise'
// 'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
}),
new webpack.DefinePlugin({
'process.env': { NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development') }
})
],
// Enable sourcemaps for debugging webpack's output.
devtool: "source-map",
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: ['.ts', '.tsx', '.js', '.jsx'],
modules: [
path.resolve(__dirname, 'node_modules')
]
},
module: {
rules: [
// All files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'.
{
test: /\.tsx?$/,
use: ['babel', 'ts-loader']
},
{
test: /vendor\/.+\.(jsx|js|ts|tsx)$/,
use: 'imports?jQuery=jquery,$=jquery,this=>window'},
{
test: /\.scss$/,
use: ["style-loader", "css-loader", "sass-loader"]
},
{
test: /\.js$/,
enforce: "pre",
use: "source-map-loader"
}
],
},
externals: {
"jquery": "$"
},
stats: {
colors: true,
modules: true,
reasons: true,
errorDetails: true
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment