refactor: removed 1.x client files

This commit is contained in:
NGPixel
2018-02-03 16:48:25 -05:00
parent 30ce9c8670
commit 23a6be1219
56 changed files with 307 additions and 2856 deletions

View File

@@ -1,12 +0,0 @@
module.exports = {
plugins: {
'autoprefixer': {},
'cssnano': {
preset: ['default', {
discardComments: {
removeAll: true
}
}]
}
}
}

View File

@@ -3,16 +3,20 @@ const fs = require('fs-extra')
const webpack = require('webpack')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const ProgressBarPlugin = require('progress-bar-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const NameAllModulesPlugin = require('name-all-modules-plugin')
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin')
const babelConfig = fs.readJsonSync(path.join(process.cwd(), '.babelrc'))
const postCSSConfig = {
config: {
path: path.join(process.cwd(), 'dev/webpack/postcss.config.js')
path: path.join(process.cwd(), 'dev/config/postcss.config.js')
}
}
const cacheDir = '.webpack-cache/cache'
const babelDir = path.join(process.cwd(), '.webpack-cache/babel')
process.noDeprecation = true
module.exports = {
entry: {
@@ -32,14 +36,14 @@ module.exports = {
{
loader: 'cache-loader',
options: {
cacheDirectory: '.webpack-cache'
cacheDirectory: cacheDir
}
},
{
loader: 'babel-loader',
options: {
...babelConfig,
cacheDirectory: true
cacheDirectory: babelDir
}
}
]
@@ -64,6 +68,12 @@ module.exports = {
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'cache-loader',
options: {
cacheDirectory: cacheDir
}
},
{
loader: 'css-loader'
},
@@ -119,14 +129,14 @@ module.exports = {
{
loader: 'cache-loader',
options: {
cacheDirectory: '.webpack-cache'
cacheDirectory: cacheDir
}
},
{
loader: 'babel-loader',
options: {
babelrc: path.join(process.cwd(), '.babelrc'),
cacheDirectory: true
cacheDirectory: babelDir
}
}
]
@@ -173,17 +183,13 @@ module.exports = {
]
},
plugins: [
new ProgressBarPlugin({
width: 72,
complete: '▇',
incomplete: '-'
}),
new webpack.BannerPlugin('Wiki.js - wiki.js.org - Licensed under AGPL'),
new CopyWebpackPlugin([
{ from: 'client/static' }
], {
}),
new LodashModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.NamedChunksPlugin((chunk) => {
if (chunk.name) {
@@ -207,7 +213,10 @@ module.exports = {
symlinks: true,
alias: {
'@': path.join(process.cwd(), 'client'),
'vue$': 'vue/dist/vue.common.js'
'vue$': 'vue/dist/vue.common.js',
// Duplicates fixes:
'apollo-link': path.join(process.cwd(), 'node_modules/apollo-link'),
'apollo-utilities': path.join(process.cwd(), 'node_modules/apollo-utilities')
},
extensions: [
'.js',

View File

@@ -3,6 +3,7 @@ const merge = require('webpack-merge')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const WriteFilePlugin = require('write-file-webpack-plugin')
const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin')
const common = require('./webpack.common.js')
@@ -15,6 +16,9 @@ module.exports = merge(common, {
publicPath: '/'
},
plugins: [
new SimpleProgressWebpackPlugin({
format: 'compact'
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
}),

View File

@@ -1,11 +1,13 @@
const webpack = require('webpack')
const merge = require('webpack-merge')
const path = require('path')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OfflinePlugin = require('offline-plugin')
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin')
const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin')
const common = require('./webpack.common.js')
@@ -14,6 +16,9 @@ module.exports = merge(common, {
rules: []
},
plugins: [
new SimpleProgressWebpackPlugin({
format: 'expanded'
}),
new CleanWebpackPlugin([
'assets/js/*.*',
'assets/css/*.*',
@@ -23,22 +28,44 @@ module.exports = merge(common, {
root: process.cwd(),
verbose: false
}),
new UglifyJSPlugin(),
new UglifyJSPlugin({
cache: path.join(process.cwd(), '.webpack-cache/uglify'),
parallel: true
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new ExtractTextPlugin('css/bundle.css'),
new OfflinePlugin({
publicPath: '/',
externals: ['/'],
caches: {
main: [
'js/runtime.js',
'js/vendor.js',
'js/client.js'
],
additional: [':externals:'],
optional: ['*.chunk.js']
}
additional: [
':externals:'
],
optional: [
'js/*.chunk.js'
]
},
safeToUseOptionalCaches: true
}),
new DuplicatePackageCheckerPlugin()
new DuplicatePackageCheckerPlugin(),
// Disable Extract Text Plugin stats:
{
apply(compiler) {
compiler.plugin('done', stats => {
if (Array.isArray(stats.compilation.children)) {
stats.compilation.children = stats.compilation.children.filter(child => {
return child.name.indexOf('extract-text-webpack-plugin') !== 0
})
}
})
}
}
]
})