2018-07-27 17:31:39 +02:00
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
|
|
|
2018-09-13 20:54:34 +02:00
|
|
|
const webpack = require('webpack');
|
|
|
|
|
2018-07-27 17:31:39 +02:00
|
|
|
const PATHS = {
|
|
|
|
app: path.join(__dirname, 'src/app.js'),
|
|
|
|
css: path.join(__dirname, 'css'),
|
2018-09-14 12:44:15 +02:00
|
|
|
build: path.join(__dirname, '../assets/public/build'),
|
2018-07-27 17:31:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const cssPlugin = new ExtractTextPlugin({
|
|
|
|
filename: '[name].css',
|
|
|
|
});
|
|
|
|
|
|
|
|
// See https://github.com/webpack/loader-utils/issues/56
|
|
|
|
process.noDeprecation = true;
|
|
|
|
|
|
|
|
const config = {
|
2018-09-13 20:54:34 +02:00
|
|
|
devtool: false,
|
2018-07-27 17:31:39 +02:00
|
|
|
entry: {
|
|
|
|
app: PATHS.app,
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: PATHS.build,
|
|
|
|
filename: '[name].js',
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
modules: [
|
|
|
|
path.join(__dirname, 'src'),
|
|
|
|
path.join(__dirname, 'node_modules'),
|
|
|
|
],
|
|
|
|
alias: {
|
|
|
|
vue: 'vue/dist/vue.js',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: [
|
2018-09-13 20:54:34 +02:00
|
|
|
cssPlugin
|
2018-07-27 17:31:39 +02:00
|
|
|
],
|
|
|
|
node: {
|
|
|
|
fs: 'empty',
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.(js)$/,
|
|
|
|
include: PATHS.app,
|
|
|
|
enforce: 'pre',
|
|
|
|
loader: 'eslint-loader',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'babel-loader',
|
|
|
|
query: {
|
|
|
|
presets: ['es2015'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.vue$/,
|
|
|
|
loader: 'vue-loader',
|
|
|
|
options: {
|
|
|
|
loaders: {
|
|
|
|
js: 'babel-loader?presets[]=es2015',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
include: PATHS.css,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: cssPlugin.extract({
|
|
|
|
use: 'css-loader',
|
|
|
|
fallback: 'style-loader',
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
include: /node_modules/,
|
|
|
|
loaders: ['style-loader', 'css-loader']
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.scss$/,
|
|
|
|
loaders: ['style-loader', 'css-loader', 'sass-loader']
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2)$/,
|
|
|
|
loader: 'url-loader',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(wav|mp3|eot|ttf)$/,
|
|
|
|
loader: 'file-loader',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.svg/,
|
|
|
|
use: {
|
|
|
|
loader: 'svg-url-loader',
|
|
|
|
options: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
// No sourcemap for production
|
2018-09-13 20:54:34 +02:00
|
|
|
if (process.env.NODE_ENV !== "production") {
|
|
|
|
const devToolPlugin = new webpack.SourceMapDevToolPlugin({
|
|
|
|
filename: '[name].map',
|
|
|
|
});
|
|
|
|
|
|
|
|
config.plugins.push(devToolPlugin);
|
2018-07-27 17:31:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = config;
|