Skip to content

Commit

Permalink
fix(taro): 小程序 webpack 编译静态文件路径
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Dec 31, 2019
1 parent 0ee1a7f commit 2e13173
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/taro-mini-runner/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/mini-runner",
"version": "1.3.1",
"version": "1.3.14",
"description": "Mini app runner for taro",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -32,8 +32,8 @@
},
"homepage": "https://github.com/NervJS/taro#readme",
"dependencies": {
"@tarojs/taro": "1.3.1",
"@tarojs/transformer-wx": "1.3.1",
"@tarojs/taro": "1.3.14",
"@tarojs/transformer-wx": "1.3.14",
"babel-core": "^6.26.3",
"babel-generator": "^6.26.1",
"babel-loader": "^8.0.6",
Expand Down
8 changes: 5 additions & 3 deletions packages/taro-mini-runner/src/webpack/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ const defaultCssModuleOption: PostcssOption.cssModules = {
}
}

const staticDirectory = 'static'

const getLoader = (loaderName: string, options: IOption) => {
return {
loader: require.resolve(loaderName),
Expand Down Expand Up @@ -282,7 +284,7 @@ export const getModule = (appPath: string, {
test: REG_MEDIA,
use: {
urlLoader: getUrlLoader([defaultMediaUrlLoaderOption, {
name: `[path][name].[ext]`,
name: `${staticDirectory}/media/[name].[ext]`,
...mediaUrlLoaderOption
}])
}
Expand All @@ -291,7 +293,7 @@ export const getModule = (appPath: string, {
test: REG_FONT,
use: {
urlLoader: getUrlLoader([defaultFontUrlLoaderOption, {
name: `[path][name].[ext]`,
name: `${staticDirectory}/fonts/[name].[ext]`,
...fontUrlLoaderOption
}])
}
Expand All @@ -300,7 +302,7 @@ export const getModule = (appPath: string, {
test: REG_IMAGE,
use: {
urlLoader: getUrlLoader([defaultImageUrlLoaderOption, {
name: `[path][name].[ext]`,
name: `${staticDirectory}/images/[name].[ext]`,
...imageUrlLoaderOption
}])
}
Expand Down

0 comments on commit 2e13173

Please sign in to comment.