Created
December 19, 2017 21:04
-
-
Save TwiN/8a451afd07b74c99eeb060ca19d6a864 to your computer and use it in GitHub Desktop.
My webpack configuration (+ package.json)
This file contains hidden or 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": "twinnation", | |
"author": "TwiN", | |
"description": "TwiNNatioN", | |
"version": "0.7.5", | |
"license": "MIT", | |
"main": "src/App.js", | |
"scripts": { | |
"start-webpack": "webpack-dev-server --port 80 --hot --progress --colors", | |
"build-webpack": "webpack --config webpack.config.js -p", | |
"start": "set PORT=80 && react-scripts start", | |
"build": "react-scripts build", | |
"test": "react-scripts test --env=jsdom", | |
"eject": "react-scripts eject" | |
}, | |
"dependencies": {}, | |
"devDependencies": { | |
"axios": "^0.17.1", | |
"jquery": "^3.2.1", | |
"react": "^16.2.0", | |
"react-bootstrap": "^0.31.5", | |
"react-burger-menu": "^2.1.11", | |
"react-dom": "^16.2.0", | |
"react-fontawesome": "^1.6.1", | |
"react-images": "^0.5.13", | |
"react-photo-gallery": "^6.0.22", | |
"react-router": "^4.2.0", | |
"react-router-dom": "^4.2.2", | |
"react-scripts": "1.0.17", | |
"react-syntax-highlighter": "^6.1.1", | |
"babel-core": "^6.26.0", | |
"babel-eslint": "^8.0.3", | |
"babel-loader": "^7.1.2", | |
"babel-preset-es2015": "^6.24.1", | |
"babel-preset-react": "^6.24.1", | |
"eslint": "^4.13.1", | |
"eslint-plugin-react": "^7.5.1", | |
"file-loader": "^1.1.6", | |
"css-loader": "^0.28.7", | |
"style-loader": "^0.19.1", | |
"url-loader": "^0.6.2", | |
"webpack": "^3.10.0", | |
"webpack-dev-server": "2.7.1", | |
"preact": "^8.2.7", | |
"preact-compat": "^3.17.0" | |
}, | |
"repository": { | |
"type": "git", | |
"url": "https://github.com/TwinProduction/TwiNNatioN" | |
} | |
} |
This file contains hidden or 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
var webpack = require('webpack'); | |
var path = require('path'); | |
var BUILD_DIR = path.resolve(__dirname, '../src/main/resources/static/'); | |
var APP_DIR = path.resolve(__dirname, 'src/'); | |
var config = { | |
entry: APP_DIR + '/index.js', | |
output: { | |
path: BUILD_DIR, | |
filename: 'bundle.js' | |
}, | |
module : { | |
loaders : [ | |
{ | |
test: /\.jsx?$/, | |
exclude: /node_modules/, | |
include: APP_DIR, | |
loader: 'babel-loader', | |
query: { | |
presets: ['es2015', 'react'] | |
} | |
}, | |
{ | |
test: /\.css$/, | |
exclude: /node_modules/, | |
loader: ['style-loader', 'css-loader'] | |
} | |
] | |
}, | |
resolve : { | |
extensions: ['.js', '.jsx'], | |
alias: { | |
"react": "preact-compat", | |
"react-dom": "preact-compat" | |
} | |
}, | |
devServer: { | |
contentBase: "./public", | |
historyApiFallback: true, | |
hot: true | |
}, | |
plugins: [ | |
new webpack.DefinePlugin({ | |
'process.env.NODE_ENV': '"production"' | |
}), | |
new webpack.optimize.UglifyJsPlugin({ | |
screw_ie8: true, | |
comments: false | |
}), | |
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/) | |
] | |
}; | |
module.exports = config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment