Created
April 3, 2017 20:13
-
-
Save Vaccano/3c76a71446e41d3308eefebc21b0707d to your computer and use it in GitHub Desktop.
Vaccano's webpack setup
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
{ | |
"license": "MIT", | |
"devDependencies": { | |
"@types/whatwg-fetch": "^0.0.33", | |
"aurelia-tools": "^1.0.0", | |
"aurelia-webpack-plugin": "^2.0.0-rc.1", | |
"chai": "^3.5.0", | |
"copy-webpack-plugin": "^4.0.1", | |
"cross-env": "^3.2.4", | |
"css-loader": "^0.27.3", | |
"del-cli": "^0.2.1", | |
"expose-loader": "^0.7.3", | |
"file-loader": "^0.10.1", | |
"glob-copy": "^0.1.0", | |
"html-loader": "^0.4.5", | |
"html-webpack-plugin": "^2.28.0", | |
"less": "^2.7.2", | |
"less-loader": "^4.0.2", | |
"raw-loader": "^0.5.1", | |
"sinon": "^2.1.0", | |
"style-loader": "^0.16.1", | |
"ts-loader": "^2.0.3", | |
"typescript": "^2.2.2", | |
"url-loader": "^0.5.8", | |
"webpack": "^2.3.2", | |
"webpack-dev-server": "^2.4.2", | |
"webpack-utf8-bom": "^1.0.3" | |
}, | |
"dependencies": { | |
"aurelia-animator-css": "^1.0.1", | |
"aurelia-binding": "^1.2.1", | |
"aurelia-bootstrapper": "^2.1.1", | |
"aurelia-breeze": "^2.2.0", | |
"aurelia-dependency-injection": "^1.3.0", | |
"aurelia-dialog": "^1.0.0-beta.3.0.1", | |
"aurelia-event-aggregator": "^1.0.1", | |
"aurelia-fetch-client": "^1.1.2", | |
"aurelia-framework": "^1.1.1", | |
"aurelia-history": "^1.0.0", | |
"aurelia-history-browser": "^1.0.0", | |
"aurelia-http-client": "^1.1.0", | |
"aurelia-loader": "^1.0.0", | |
"aurelia-logging": "^1.3.1", | |
"aurelia-logging-console": "^1.0.0", | |
"aurelia-metadata": "^1.0.3", | |
"aurelia-pal-browser": "^1.2.0", | |
"aurelia-path": "^1.1.1", | |
"aurelia-polyfills": "^1.2.1", | |
"aurelia-route-recognizer": "^1.1.0", | |
"aurelia-router": "^1.2.1", | |
"aurelia-task-queue": "^1.2.0", | |
"aurelia-templating": "^1.4.0", | |
"aurelia-templating-binding": "^1.3.0", | |
"aurelia-templating-resources": "^1.3.1", | |
"aurelia-templating-router": "^1.1.0", | |
"bluebird": "^3.5.0", | |
"bootstrap": "^3.3.7", | |
"breeze-client": "^1.6.3", | |
"css": "^2.2.1", | |
"font-awesome": "^4.7.0", | |
"jquery": "^3.2.1", | |
"moment": "^2.18.1", | |
"mousetrap": "^1.6.0", | |
"ms-signalr-client": "^2.2.5", | |
"reflect-metadata": "^0.1.10", | |
"whatwg-fetch": "^2.0.3" | |
}, | |
"scripts": { | |
"web": "webpack-dev-server --hot --inline", | |
"watch": "npm run watch:dev", | |
"watch:dev": "npm run build:dev -- --watch", | |
"build:dev": "cross-env NODE_ENV=development npm run webpack -- --progress --profile", | |
"prebuild:dev": "npm run clean:dist", | |
"build:prod": "cross-env NODE_ENV=production npm run webpack -- --progress --profile", | |
"clean": "npm cache clean && del-cli node_modules \"test/coverage\" dist", | |
"clean:dist": "del-cli dist", | |
"webpack": "cross-env TS_NODE_PROJECT=tsconfig.tsnode.json TS_NODE_FAST=true ./node_modules/.bin/webpack --display-modules", | |
"webpack-dev-server": "cross-env TS_NODE_PROJECT=tsconfig.tsnode.json TS_NODE_FAST=true ./node_modules/.bin/webpack-dev-server" | |
} | |
} |
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
const path = require('path'); | |
const { AureliaPlugin, ModuleDependenciesPlugin } = require('aurelia-webpack-plugin'); | |
const CopyPlugin = require('copy-webpack-plugin'); | |
const BomPlugin = require('webpack-utf8-bom'); | |
const ProvidePlugin = require('webpack/lib/ProvidePlugin'); | |
module.exports = { | |
entry: 'aurelia-bootstrapper', | |
devtool: 'inline-source-map', | |
output: { | |
path: path.resolve(__dirname, 'dist'), | |
publicPath: '/dist/', | |
filename: 'bundle.js' | |
}, | |
resolve: { | |
extensions: ['.ts', '.js'], | |
modules: ['src', 'node_modules'].map(x => path.resolve(x)) | |
}, | |
module: { | |
rules: [ | |
{ test: /\.less$/i, use: ['style-loader', 'css-loader', 'less-loader'] }, | |
{ test: /\.css$/i, use: 'css-loader'}, | |
{ test: /\.ts$/i, use: 'ts-loader' }, | |
{ test: /\.html$/i, use: 'html-loader' }, | |
{ test: /\.html$/i, use: 'html-loader' }, | |
{ test: /\.(png|gif|jpg|ico)$/i, use: 'url-loader?limit=8192' }, | |
{ test: /\.woff2(\?v=[0-9]\.[0-9]\.[0-9])?$/i, use: 'url-loader?limit=10000&minetype=application/font-woff2' }, | |
{ test: /\.woff(\?v=[0-9]\.[0-9]\.[0-9])?$/i, use: 'url-loader?limit=10000&minetype=application/font-woff' }, | |
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/i, use: 'file-loader' }, | |
// Expose breeze globaly. This is needed to work with aurelia-breeze | |
// https://github.com/webpack-contrib/expose-loader | |
{ test: require.resolve('breeze-client'), use: [{ loader: 'expose-loader', options: 'breeze'}] } | |
] | |
}, | |
plugins: [ | |
new AureliaPlugin({ | |
includeAll: 'src' | |
}), | |
new ModuleDependenciesPlugin({ | |
"aurelia-dialog": [ './ai-dialog', './ai-dialog-header', './ai-dialog-body', | |
'./ai-dialog-footer', './attach-focus' ] | |
}), | |
new CopyPlugin([ | |
{from: 'index.html'}, | |
{from: 'web.config'}, | |
{from: 'plugins/log4javascript', to: 'plugins/log4javascript'} | |
]), | |
// https://www.npmjs.com/package/webpack-utf8-bom | |
// http://stackoverflow.com/questions/43130088/uncaught-syntaxerror-invalid-or-unexpected-token-%C3%AF | |
new BomPlugin(true), | |
new ProvidePlugin( | |
{ | |
$: 'jquery', | |
jQuery: 'jquery', | |
"window.jQuery": 'jquery', | |
Promise: 'bluebird' | |
}) | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment