0

I am creating an Azure DevOps build pipeline for one of my Vue.js projects and always getting the preceding error.

enter image description here

./index.js → ./dist/bundle.esm.js... [!] Error: Could not resolve './src/components/uiListItem.vue' from index.js Error: Could not resolve './src/components/uiListItem.vue' from index.js at error (/home/vsts/work/1/s/node_modules/rollup/dist/shared/node-entry.js:5400:30) at ModuleLoader.handleResolveId (/home/vsts/work/1/s/node_modules/rollup/dist/shared/node-entry.js:12410:24) at ModuleLoader. (/home/vsts/work/1/s/node_modules/rollup/dist/shared/node-entry.js:12298:30) at Generator.next () at fulfilled (/home/vsts/work/1/s/node_modules/rollup/dist/shared/node-entry.js:38:28)

The command npm run build and npm run build --prod works fine in local and the issue is only with the Pipeline environment. Here is my azure-pipeline.yml.

trigger:
  branches:
    include:
    - master
variables:
- name: tag
  value: '$(Build.BuildId)'
- name: vmImageName
  value: 'ubuntu-latest'
stages:
- stage: Build
  displayName: Build and push stage
  jobs:
  - job: Build
    displayName: Build
    pool:
      vmImage: $(vmImageName)
    steps:
    - task: NodeTool@0
      inputs:
        versionSpec: '10.x'
      displayName: 'Install Node.js'
    - task: Npm@1
      displayName: 'npm install'
      inputs:
        command: 'install'
        workingDir: '$(Build.SourcesDirectory)'
        verbose: false
    - task: Npm@1
      displayName: 'npm run build'
      inputs:
        command: 'custom'
        workingDir: '$(Build.SourcesDirectory)'
        customCommand: 'run build'

1 Answer 1

0

I figured out what was the issue. In the pipeline the the vmImage is ubuntu-latest as that is a Linux distribution, it was unable to find the specified file, so I had to change the file references from using ./src/components/uiListItem.vue to src/components/uiListItem.vue from index.js file. Please note that there is no ./.

export { default as uiListItem } from "src/components/uiListItem.vue";

I just did this for all the references and the build was successful then.

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.