webpack@2 #222

Merged
neb-b merged 3 commits from webpack-2 into master 2017-06-12 18:07:13 +02:00
2 changed files with 29 additions and 29 deletions
Showing only changes of commit 3a89a75e7d - Show all commits

View file

@ -1,23 +1,23 @@
const path = require('path'); const path = require("path");
const webpack = require('webpack') const webpack = require("webpack")
const appPath = path.resolve(__dirname, 'js'); const appPath = path.resolve(__dirname, "js");
const PATHS = { const PATHS = {
app: path.join(__dirname, 'app'), app: path.join(__dirname, "app"),
dist: path.join(__dirname, 'dist') dist: path.join(__dirname, "dist")
}; };
module.exports = { module.exports = {
entry: ['babel-polyfill', './js/main.js'], entry: ["babel-polyfill", "./js/main.js"],
output: { output: {
path: path.join(PATHS.dist, 'js'), path: path.join(PATHS.dist, "js"),
publicPath: '/js/', publicPath: "/js/",
filename: "bundle.js" filename: "bundle.js"
}, },
devtool: 'source-map', devtool: "source-map",
resolve: { resolve: {
modules: [appPath, "node_modules"], modules: [appPath, "node_modules"],
extensions: ['.js', '.jsx', '.css'] extensions: [".js", ".jsx", ".css"]
}, },
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
@ -29,7 +29,7 @@ module.exports = {
{ {
test: /\.jsx?$/, test: /\.jsx?$/,
enforce: "pre", enforce: "pre",
loaders: ['eslint'], loaders: ["eslint"],
// define an include so we check just the files we need // define an include so we check just the files we need
include: PATHS.app include: PATHS.app
}, },
@ -41,14 +41,14 @@ module.exports = {
test: /\.jsx?$/, test: /\.jsx?$/,
exclude: /node_modules/, exclude: /node_modules/,
use: { use: {
loader: 'babel-loader', loader: "babel-loader",
options: { options: {
cacheDirectory: true, cacheDirectory: true,
presets: [ 'es2015', 'react', 'stage-2' ] presets: [ "es2015", "react", "stage-2" ]
} }
} }
} }
] ]
}, },
target: 'electron-main', target: "electron-main",
}; };

View file

@ -1,27 +1,27 @@
const path = require('path'); const path = require("path");
const webpack = require('webpack') const webpack = require("webpack")
const WebpackNotifierPlugin = require('webpack-notifier') const WebpackNotifierPlugin = require("webpack-notifier")
const appPath = path.resolve(__dirname, 'js'); const appPath = path.resolve(__dirname, "js");
const PATHS = { const PATHS = {
app: path.join(__dirname, 'app'), app: path.join(__dirname, "app"),
dist: path.join(__dirname, '..', 'app', 'dist') dist: path.join(__dirname, "..", "app", "dist")
}; };
module.exports = { module.exports = {
entry: ['babel-polyfill', './js/main.js'], entry: ["babel-polyfill", "./js/main.js"],
output: { output: {
path: path.join(PATHS.dist, 'js'), path: path.join(PATHS.dist, "js"),
publicPath: '/js/', publicPath: "/js/",
filename: "bundle.js", filename: "bundle.js",
pathinfo: true pathinfo: true
}, },
cache: true, cache: true,
devtool: 'eval', devtool: "eval",
resolve: { resolve: {
modules: [appPath, "node_modules"], modules: [appPath, "node_modules"],
extensions: ['.js', '.jsx', '.css'] extensions: [".js", ".jsx", ".css"]
}, },
plugins: [ plugins: [
new WebpackNotifierPlugin(), new WebpackNotifierPlugin(),
@ -37,7 +37,7 @@ module.exports = {
{ {
test: /\.jsx?$/, test: /\.jsx?$/,
enforce: "pre", enforce: "pre",
loaders: ['eslint'], loaders: ["eslint"],
// define an include so we check just the files we need // define an include so we check just the files we need
include: PATHS.app include: PATHS.app
}, },
@ -49,14 +49,14 @@ module.exports = {
test: /\.jsx?$/, test: /\.jsx?$/,
exclude: /node_modules/, exclude: /node_modules/,
use: { use: {
loader: 'babel-loader', loader: "babel-loader",
options: { options: {
cacheDirectory: true, cacheDirectory: true,
presets: [ 'es2015', 'react', 'stage-2' ] presets: [ "es2015", "react", "stage-2" ]
} }
} }
} }
] ]
}, },
target: 'electron-main', target: "electron-main",
}; };