12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- 'use strict'
- const HtmlWebpackPlugin = require('html-webpack-plugin')
- const CopyWebpackPlugin = require('copy-webpack-plugin')
- const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin');
- const { VueLoaderPlugin } = require('vue-loader')
- // const { GlslLoaderPlugin } = require('webpack-glsl-loader')
- const utils = require('./utils')
- module.exports = {
- resolve: {
- extensions: ['.js', '.vue', '.json', '.glsl'],
- alias: {
- 'assets': utils.resolve('assets'),
- 'pages': utils.resolve('src/pages'),
- 'static': utils.resolve('static'),
- 'components': utils.resolve('src/components'),
- 'api': utils.resolve('src/api'),
- 'store': utils.resolve('src/store')
- }
- },
- module: {
- rules: [
- {
- test: /\.(js|vue)$/,
- use: 'eslint-loader',
- enforce: 'pre'
- }, {
- test: /\.vue$/,
- use: 'vue-loader'
- }, {
- test: /\.glsl$/,
- loader: 'webpack-glsl-loader'
- }, {
- test: /\.js$/,
- use: {
- loader: 'babel-loader',
- }
- }, {
- test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
- use: {
- loader: 'url-loader',
- options: {
- limit: 10000,
- name: utils.assetsPath('img/[name].[hash:7].[ext]')
- }
- }
- }, {
- test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
- use: {
- loader: 'url-loader',
- options: {
- limit: 10000,
- name: utils.assetsPath('media/[name].[hash:7].[ext]')
- }
- }
- }, {
- test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
- use: {
- loader: 'url-loader',
- options: {
- limit: 10000,
- name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
- }
- }
- }
- ]
- },
- plugins: [
- new HtmlWebpackPlugin({
- filename: 'index.html',
- template: 'index.html',
- inject: true,
- alwaysWriteToDisk: true
- }),
- new HtmlWebpackHarddiskPlugin(),
- new VueLoaderPlugin(),
- // new GlslLoaderPlugin(),
- new CopyWebpackPlugin([{
- from: utils.resolve('static/img'),
- to: utils.resolve('dist/static/img'),
- toType: 'dir'
- }])
- ]
- }
|