Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

How to use this in jade-loader? #53

Open
Teemo12345 opened this issue Jun 24, 2017 · 1 comment
Open

How to use this in jade-loader? #53

Teemo12345 opened this issue Jun 24, 2017 · 1 comment

Comments

@Teemo12345
Copy link

Teemo12345 commented Jun 24, 2017

const path = require("path"),
webpack = require("webpack"),
htmlWebpackPlugin = require("html-webpack-plugin");
const i18nWebpackPlugin = require('i18n-webpack-plugin');

function getConfig(lang){
	return {
		entry:{
			index:"./src/app/page/index.js"
		},
		output:{
			path:path.resolve(__dirname+"/dist/"),
			filename:lang+"/js/"+lang+"-[name]-[hash:5].js"
		},
		module:{
			rules:[
				{
					test:/\.jade$/,
					loader:"jade-loader",
					options:{
						pretty:true,
						template:{__:__}
					}				
				},
				{
					test:/\.json$/,
					loader:"json-loader"
				}
			]
		},
		plugins:[
			new webpack.ProvidePlugin({
				$:'jquery'
			}),
			new i18nWebpackPlugin(languages[lang]),
			new htmlWebpackPlugin({
				template:'src/tmpl/index.jade',
				filename:lang+"/index.html"
			})
		],
		
	}
}

let languages = {
	"en_US":"/src/config/locales/en.json",
	"zh_CN":"/src/config/locales/zh.json"
}
module.exports=Object.keys(languages).map(function(lang){
	return getConfig(lang)
	
})

ERROR in Template execution failed: TypeError: __ is not a function

ERROR in   TypeError: __ is not a function
@Teemo12345
Copy link
Author

Teemo12345 commented Jul 12, 2017

@jhnns @bebraw use i18n-webpack-plugin on Support jade-loader ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant