0
我的WebPack構建不包括我的資源文件夾入DIST構建,這是造成我的翻譯文件永遠不會回升,因此沒有轉換正在發生......的WebPack建立不包括資源/ JSON文件
文件結構:
dist
//I need my json files from src/resources here
src
app // holds all components
resources
locale-en-us.json
locale-fr-fr-json
locale-ru-ru.json
locale-zh-cn-json
webpack
webpack.common.js
webpack.server.js
weback.server.js:
const { root } = require('./helpers');
const { AotPlugin } = require('@ngtools/webpack');
module.exports = {
entry: root('./src/main.server.ts'),
output: {
filename: 'server.js'
},
target: 'node'
};
個webpack.common.js
const { root } = require('./helpers');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
/**
* This is a common webpack config which is the base for all builds
*/
module.exports = {
devtool: 'cheap-module-source-map',
resolve: {
extensions: ['.ts', '.js']
},
output: {
path: root('dist')
},
module: {
rules: [
{ test: /\.ts$/, loader: '@ngtools/webpack' },
{ test: /\.html$/, loader: 'raw-loader' },
{ test: /\.less$/, loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader?sourceMap!less-loader?sourceMap' }) },
{ test: /\.scss$/, loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader?sourceMap!sass-loader?sourceMap' }) },
{ test: /\.css$/, loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader?sourceMap' }) },
{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url-loader?limit=8192&minetype=application/font-woff&name=fonts/[name].[hash].[ext]' },
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'file-loader?name=fonts/[name].[hash].[ext]' },
{ test: /\.(jpg|jpeg|png|gif)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url-loader?limit=4096&name=images/[name].[hash].[ext]' }
]
},
plugins: [
new ExtractTextPlugin('[name].css')
]
};
我使用的WebPack V2.5.1。有人知道我在這裏想念什麼嗎?這是我的理解,我不應該在Webpack版本2.0 +中包含任何json加載器
我是否需要將資源文件夾中的文件導入某處?
感謝您的幫助! – bschmitty