以下是我的webpack配置。目前文件加载了这个main.js入口点
import './resources/assets/js/app.js';
import './resources/assets/sass/main.scss';
我可以在public / js文件中同时获取这两个文件,但是我想在自己的文件夹中获取css和js。这可能吗?
var webpack = require('webpack');
var path = require('path');
let ExtractTextPlugin = require("extract-text-webpack-plugin");
var WebpackNotifierPlugin = require('webpack-notifier');
module.exports = {
resolve: {
alias: {
'masonry': 'masonry-layout',
'isotope': 'isotope-layout'
}
},
entry: './main.js',
devtool: 'source-map',
output: {
path: path.resolve(__dirname, './public'),
filename: 'bundle.js'
},
module: {
rules: [
{ test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader?presets[]=es2015",
},
{
test:/\.scss$/,
use: ExtractTextPlugin.extract({
use: [{loader:'css-loader?sourceMap'}, {loader:'sass-loader', options: {
sourceMap: true
}}],
})
},
/*{
test : /\.(png|jpg|svg)$/,
include : path.join(__dirname, '/dist/'),
loader : 'url-loader?limit=30000&name=images/[name].[ext]'
}, */
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
}
// other vue-loader options go here
}
},
]
},
plugins: [
//new webpack.optimize.UglifyJsPlugin(),
new ExtractTextPlugin('app.css'),
new WebpackNotifierPlugin(),
]
};