Skip to content

Commit

Permalink
update webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
dimensi committed Apr 19, 2017
1 parent f15e522 commit f78b4d7
Show file tree
Hide file tree
Showing 6 changed files with 1,490 additions and 1,065 deletions.
57 changes: 2 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## TOC ##


- [FrontEnd Ruranobe](#frontend-ruranobe)
- [GulpPack](#)
* [Зависимости](#Зависимости)
* [Первый запуск](#Первый-запуск)
* [Команды](#Команды)
Expand All @@ -24,7 +24,6 @@
+ [`gulp serve`](#gulp-serve)
+ [`build:dev`](#builddev)
+ [`build`](#build)
* [Установленные пакеты](#Установленные-пакеты)


## Зависимости ##
Expand Down Expand Up @@ -71,56 +70,4 @@
### `gulp build`
Собирает все и оптимизирует
### `gulp zip`
Собирает архив из public


## Установленные пакеты ##
```
"babel-core": "^6.21.0",
"babel-loader": "^6.2.10",
"babel-plugin-transform-class-properties": "^6.19.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.18.0",
"babel-plugin-transform-object-rest-spread": "^6.20.2",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-env": "^1.1.8",
"babel-preset-es2015": "^6.18.0",
"babel-runtime": "^6.20.0",
"bemto.pug": "^2.1.0",
"browser-sync": "^2.18.6",
"browser-sync-close-hook": "^1.0.5",
"cross-env": "^3.1.4",
"del": "^2.2.2",
"eslint": "^3.13.1",
"exports-loader": "^0.6.3",
"expose-loader": "^0.7.1",
"gulp": "gulpjs/gulp#4.0",
"gulp-autoprefixer": "^3.1.1",
"gulp-changed": "^1.3.2",
"gulp-clean-css": "^2.3.2",
"gulp-concat-css": "^2.3.0",
"gulp-debug": "^3.0.0",
"gulp-if": "^2.0.2",
"gulp-imagemin": "^3.1.1",
"gulp-load-plugins": "^1.4.0",
"gulp-notify": "^2.2.0",
"gulp-plumber": "^1.1.0",
"gulp-pug": "^3.2.0",
"gulp-sourcemaps": "^2.4.0",
"gulp-stylus": "^2.6.0",
"gulp-tinypng-compress": "^1.2.1",
"gulp-zip": "^3.2.0",
"gulplog": "^1.0.0",
"happypack": "^3.0.2",
"imports-loader": "^0.7.0",
"jade-get-data": "^1.0.1",
"jquery": "^3.1.1",
"mkdirp": "^0.5.1",
"node-notifier": "^4.6.1",
"normalize.css": "^5.0.0",
"rupture": "^0.6.2",
"script-loader": "^0.7.0",
"stream-combiner2": "^1.1.1",
"vinyl-named": "^1.1.0",
"webpack": "^1.14.0",
"webpack-stream": "jeroennoten/webpack-stream#patch-1"
```
Собирает архив из public
2 changes: 1 addition & 1 deletion app/javascripts/app.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log('GulpPack console: Hello');
console.log('GulpPack started');
7 changes: 4 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const path = require('path');
const rupture = require('rupture');
const webpackStream = require('webpack-stream');
const webpackOptions = require('./webpack.config');
const webpack = require('webpack');
const named = require('vinyl-named');
const gulplog = require('gulplog');
const mkdir = require('mkdirp');
Expand Down Expand Up @@ -37,7 +38,7 @@ const paths = {
stylusWatch: [
'./app/blocks/**/*.styl',
'./app/styles/**/*.styl'
],
],

vendorsCss: [
'./node_modules/normalize.css/normalize.css',
Expand Down Expand Up @@ -132,7 +133,7 @@ gulp.task('mkdirs', done => {
message: 'Созданы'
});

done()
done();
});

gulp.task('clean', () =>
Expand Down Expand Up @@ -244,7 +245,7 @@ gulp.task('webpack', callback => {
return gulp.src(paths.javascripts)
.pipe($.plumber(config.plumber('WEBPACK')))
.pipe(named())
.pipe(webpackStream(webpackOptions, null, done))
.pipe(webpackStream(webpackOptions, webpack, done))
.pipe(gulp.dest(paths.public + '/js'))
.on('data', () => {
if (firstBuildReady) {
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "cross-env NODE_ENV=production gulp build",
"clean": "gulp clean",
"zip": "gulp zip",
"create:block": "node makeBlock.js"
"create:block": "node makeBlock.js"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -40,41 +40,41 @@
"bemto.pug": "^2.1.0",
"browser-sync": "^2.18.6",
"browser-sync-close-hook": "^1.0.5",
"cross-env": "^3.1.4",
"cross-env": "^4.0.0",
"del": "^2.2.2",
"emitty": "^1.3.0",
"eslint": "^3.13.1",
"exports-loader": "^0.6.3",
"expose-loader": "^0.7.1",
"gulp": "gulpjs/gulp#4.0",
"gulp-autoprefixer": "^3.1.1",
"gulp-changed": "^1.3.2",
"gulp-clean-css": "^2.3.2",
"gulp-changed": "^2.0.0",
"gulp-clean-css": "^3.0.4",
"gulp-concat-css": "^2.3.0",
"gulp-debug": "^3.0.0",
"gulp-if": "^2.0.2",
"gulp-imagemin": "^3.1.1",
"gulp-load-plugins": "^1.4.0",
"gulp-notify": "^2.2.0",
"gulp-notify": "^3.0.0",
"gulp-plumber": "^1.1.0",
"gulp-pug": "^3.2.0",
"gulp-sourcemaps": "^2.4.0",
"gulp-stylus": "^2.6.0",
"gulp-tinypng-compress": "^1.2.1",
"gulp-zip": "^3.2.0",
"gulp-zip": "^4.0.0",
"gulplog": "^1.0.0",
"happypack": "^3.0.2",
"imports-loader": "^0.7.0",
"jade-get-data": "^1.0.1",
"jquery": "^3.1.1",
"mkdirp": "^0.5.1",
"node-notifier": "^4.6.1",
"normalize.css": "^5.0.0",
"node-notifier": "^5.1.2",
"normalize.css": "^6.0.0",
"rupture": "^0.6.2",
"script-loader": "^0.7.0",
"stream-combiner2": "^1.1.1",
"vinyl-named": "^1.1.0",
"webpack": "^1.14.0",
"webpack": "^2.4.1",
"webpack-stream": "jeroennoten/webpack-stream#patch-1"
}
}
27 changes: 15 additions & 12 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ module.exports = {
* common: "./javascript/common" и или можно включить в common другие файлы
* common: ["./javascript/welcome", "./javascript/common"]
*/

/**
* Куда сохранять js
*/

output: {
publicPath: '/js/', // паблик патч лучше его указазывать его разным для продакшен
library: '[name]',
Expand All @@ -52,7 +52,7 @@ module.exports = {
/**
* Собираю source-map, разные при разных режимах
*/
devtool: NODE_ENV == 'development' ? 'source-map' : null,
devtool: NODE_ENV == 'development' ? 'source-map' : false,

/**
* Подключаю плагины
Expand All @@ -67,7 +67,7 @@ module.exports = {
new webpack.DefinePlugin({
NODE_ENV: JSON.stringify(NODE_ENV)
}),
new webpack.NoErrorsPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
minChunks: minChunks
Expand All @@ -78,8 +78,8 @@ module.exports = {
'window.jQuery': 'jquery'
}),
new HappyPack({
loaders: ['babel'],
threads: 4,
loaders: ['babel-loader'],
threads: 2,
verbose: false,
cache: true
})
Expand All @@ -98,22 +98,25 @@ module.exports = {
* Указываю пути где надо искать
*/
resolve: {
root: [paths.js, paths.vendors, paths.blocks],
modules: [
paths.js,
paths.vendors,
paths.blocks,
'node_modules'
],
alias: {
jQuery: 'jquery',
jquery: 'jquery',
},
modulesDirectories: ['node_modules'],
extensions: ['', '.js',]
extensions: ['.js',]
},

/**
* Указываю пути для лоадеров
*/
resolveLoader: {
modulesDirectories: ['node_modules'],
moduleTemplates: ['*-loader', '*'],
extensions: ['', '.js']
modules: ['node_modules'],
extensions: ['.js']
},

/**
Expand All @@ -123,7 +126,7 @@ module.exports = {
*/
module: {

loaders: [
rules: [
{
test: /\.js$/,
include: [paths.js, paths.blocks, paths.vendors],
Expand Down
Loading

0 comments on commit f78b4d7

Please sign in to comment.