seepur/webpack.config.js

90 lines
2.4 KiB
JavaScript
Raw Normal View History

const path = require('path');
const webpack = require('webpack');
2020-04-12 14:25:42 +00:00
const {VueLoaderPlugin} = require('vue-loader');
require('babel-loader');
require('ts-loader');
const resolve = relativePath => path.resolve(__dirname, '..', relativePath);
module.exports = {
mode: 'development',
entry: {
'components/navbar': './resources/scripts/components/navbar.ts',
'views/register': './resources/scripts/views/register.ts',
2020-02-02 22:42:18 +00:00
'applications/home': './resources/scripts/applications/home/main.vue',
2020-03-17 22:16:34 +00:00
'applications/admin': './resources/scripts/applications/admin/main.vue',
2020-02-02 22:42:18 +00:00
},
output: {
filename: 'scripts/[name]/app.bundle.js',
path: path.resolve(__dirname, 'public'),
},
module: {
rules: [
{
// vue-loader config to load `.vue` files or single file components.
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
// https://vue-loader.vuejs.org/guide/scoped-css.html#mixing-local-and-global-styles
css: [
'vue-style-loader', {
loader: 'css-loader',
}
],
ts: [
'ts-loader',
],
js: [
'babel-loader',
],
},
cacheBusting: true,
},
},
{
2020-02-02 22:42:18 +00:00
test: /\.ts?$/,
use: [
{loader: 'babel-loader'}, {
loader: 'ts-loader',
options: {
2020-02-02 22:42:18 +00:00
appendTsSuffixTo: [/\.vue$/, /\.ts$/],
appendTsxSuffixTo: [/\.tsx\.vue$/]
}
}
],
exclude: /node_modules/
},
{
// This is required for other javascript you are gonna write besides
// vue.
test: /\.js$/,
loader: 'babel-loader',
include: [
resolve('src'),
resolve('node_modules/webpack-dev-server/client'),
],
},
]
},
plugins: [
new webpack.NamedModulesPlugin(),
new VueLoaderPlugin(),
new webpack.HotModuleReplacementPlugin(),
],
resolve: {
/**
* The compiler-included build of vue which allows to use vue templates
* without pre-compiling them
*/
alias: {
'vue$': 'vue/dist/vue.esm.js',
},
extensions: ['*', '.vue', '.js', '.ts', '.json'],
},
watchOptions: {aggregateTimeout: 300, poll: 1000},
// webpack outputs performance related stuff in the browser.
performance: {
hints: false,
},
node: {fs: 'empty'}
}