Initial config for asset chunking
This commit is contained in:
Sampsa Lohi 2020-05-10 12:12:25 +03:00
Родитель ad53a5bebb
Коммит 8eb48f81d5
8 изменённых файлов: 24 добавлений и 45 удалений

6
.gitignore поставляемый
Просмотреть файл

@ -11,8 +11,6 @@ js/*
### NPM ###
# Node modules
src/node_modules
node_modules
# Package lock
src/package-lock.json
# Temporary dist scripts
src/dist/*.js*
package-lock.json

Просмотреть файл

@ -2,7 +2,7 @@
"name": "nextcloud-cookbook",
"version": "0.7.0",
"description": "",
"main": "main.js",
"main": "src/main.js",
"scripts": {
"build": "node node_modules/webpack/bin/webpack.js --progress --hide-modules --config webpack.build.js",
"dev": "node node_modules/webpack/bin/webpack.js --progress --watch --config webpack.devel.js",
@ -31,7 +31,6 @@
"babel-loader": "^8.1.0",
"css-loader": "^3.5.2",
"file-loader": "^6.0.0",
"filemanager-webpack-plugin": "^2.0.5",
"url-loader": "^4.1.0",
"vue-loader": "^15.9.1",
"vue-style-loader": "^4.1.2",

1
src/dist/README поставляемый
Просмотреть файл

@ -1 +0,0 @@
This is where Node and Webpack write the script files before tinyfying and moving them to the app js folder.

Просмотреть файл

@ -1,18 +0,0 @@
const merge = require('webpack-merge')
const common = require('./webpack.config.js')
const FileManager = require('filemanager-webpack-plugin')
module.exports = merge(common, {
mode: 'production',
devtool: 'source-map',
plugins: [
new FileManager({
onEnd: {
copy: [
{ source: 'dist/script.js', destination: '../js/vue.js' },
{ source: 'dist/script.js.map', destination: '../js/vue.js.map' }
],
},
}),
],
})

Просмотреть файл

@ -1,17 +0,0 @@
const merge = require('webpack-merge')
const common = require('./webpack.config.js')
const FileManager = require('filemanager-webpack-plugin')
module.exports = merge(common, {
mode: 'development',
devtool: 'inline-cheap-source-map',
plugins: [
new FileManager({
onEnd: {
copy: [
{ source: 'dist/script.js', destination: '../js/vue.js' }
],
},
}),
],
})

7
webpack.build.js Normal file
Просмотреть файл

@ -0,0 +1,7 @@
const merge = require('webpack-merge')
const common = require('./webpack.config.js')
module.exports = merge(common, {
mode: 'production',
devtool: 'source-map',
})

Просмотреть файл

@ -9,10 +9,14 @@ const { VueLoaderPlugin } = require('vue-loader')
module.exports = {
entry: path.join(__dirname, 'main.js'),
entry:{
script: path.join(__dirname, 'src', 'main.js'),
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'script.js',
path: path.resolve(__dirname, './js'),
publicPath: '/js/',
filename: '[name].js',
chunkFilename: '[name].js?v=[contenthash]',
},
module: {
rules: [

7
webpack.devel.js Normal file
Просмотреть файл

@ -0,0 +1,7 @@
const merge = require('webpack-merge')
const common = require('./webpack.config.js')
module.exports = merge(common, {
mode: 'development',
devtool: 'inline-cheap-source-map',
})