Created
June 8, 2017 07:27
-
-
Save finethanks/67a9c21ab6d274e07c8e82604943dcf9 to your computer and use it in GitHub Desktop.
extract plugin не резовит свою папку в node_modules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const NODE_ENV = process.env.NODE_ENV || 'development'; | |
const ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
const extractSass = new ExtractTextPlugin("style.css"); | |
const nodeModulesPath = path.resolve(__dirname, '', 'node_modules'); | |
const assetsPath = path.resolve(__dirname, '', 'templates/src'); | |
const buildPath = path.resolve(__dirname, '', 'templates/.default'); | |
module.exports = { | |
entry: "./templates/src/app.js", | |
output: { | |
path: buildPath, | |
filename: "script.js", | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.js?$/, | |
exclude: /node_modules/, | |
use: ["babel-loader"] | |
}, | |
{ | |
rules: [{ | |
test: /\.s?css$/, | |
use: extractSass.extract({ | |
use: [ | |
{ | |
loader: "css-loader", // translates CSS into CommonJS | |
}, | |
{ | |
loader: "resolve-url-loader?sourceMap" // translates CSS into CommonJS | |
}, | |
{ | |
loader: "sass-loader?sourceMap", // compiles Sass to CSS | |
options: { | |
includePaths: [] | |
} | |
} | |
], | |
fallback: 'style-loader' | |
}) | |
}] | |
} | |
] | |
}, | |
plugins: [ | |
extractSass | |
], | |
watch: NODE_ENV === 'development' | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment