Skip to content

Commit

Permalink
fix module build
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Sep 8, 2020
1 parent e330900 commit 0248768
Show file tree
Hide file tree
Showing 6 changed files with 752 additions and 232 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ node_modules
.nuxt
*.log
cache/
dist/
ipx
.DS_Store
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
"files": [
"dist"
],
"main": "dist/module.js",
"scripts": {
"build": "yarn clean && tsc",
"postbuild": "copyfiles -u 1 src/**/*.css dist",
"clean": "rimraf dist",
"dev": "yarn nuxt-ts playground",
"nuxt-storybook": "ts-node src/cli",
Expand All @@ -27,12 +29,16 @@
"@nuxt/typescript-runtime": "latest",
"@nuxtjs/eslint-config-typescript": "latest",
"@nuxtjs/storybook": "^2.1.0",
"@nuxtjs/tailwindcss": "^3.0.2",
"@types/ci-info": "latest",
"@types/inquirer": "latest",
"babel-eslint": "latest",
"copyfiles": "^2.3.0",
"eslint": "latest",
"node-sass": "^4.14.1",
"nuxt-edge": "^2.14.2-26626271.34c56722",
"rimraf": "^3.0.2",
"sass-loader": "^10.0.2",
"standard-version": "latest",
"typescript": "^4.0.2"
},
Expand Down
3 changes: 2 additions & 1 deletion playground/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ export default {
'../src/module.ts'
],
buildModules: [
'@nuxt/typescript-build'
'@nuxt/typescript-build',
'@nuxtjs/tailwindcss'
],
image: {
defaultProvider: 'twicpics',
Expand Down
6 changes: 3 additions & 3 deletions src/module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import path from 'path'
import hash from 'hasha'

import { name, version } from '../package.json'
import { ModuleOptions, ProviderFactory } from './types'

const { name, version } = require('../package.json')

async function ImageModule (moduleOptions) {
const { nuxt, addServerMiddleware, addPlugin } = this

Expand All @@ -23,7 +23,7 @@ async function ImageModule (moduleOptions) {
options.presets.unshift({
name: 'lqip',
modifiers: {
width: 20
width: 30
}
})
}
Expand Down
4 changes: 2 additions & 2 deletions templates/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const image = createImage({
})


Vue.component(NuxtImage.options.name, NuxtImage)
Vue.component(NuxtImage.name, NuxtImage)

// TODO: directly plugin into vue
export default function (context, inject) {
inject('img', image)
inject('img', image)
}
Loading

0 comments on commit 0248768

Please sign in to comment.