Answer the question
In order to leave comments, you need to log in
Webpack: How to save imported JS, CSS in different folders?
There was such a problem. I'm on my second day learning Webpack after switching from Gulp/Grunt. I can’t figure out how to save, for example, a CSS file to a separate folder, and not where my bundle (JS file) is saved.
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var Webpack = require('webpack');
var path = require('path');
var ROOT_PATH = path.resolve(__dirname);
var APP_PATH = path.resolve(ROOT_PATH, 'dev/js/app');
var BUILD_PATH = path.resolve(ROOT_PATH, 'build');
module.exports = {
entry: APP_PATH,
output: {
path: BUILD_PATH,
publicPath: BUILD_PATH + '/',
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /(node_modules)/,
loader: "uglify!babel-loader"
},
{
test: /\.min\.css/,
loader: ExtractTextPlugin.extract("css-loader")
},
{
test: /\.styl$/,
loader: ExtractTextPlugin.extract("css-loader!stylus-loader")
}
]
},
plugins: [new ExtractTextPlugin("bundle.css")]
};
import {Test} from './classes/test'
import '../stylus/app.styl';
var test = new Test();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question