stencil-community / stencil-postcss

Autoprefixer plugin for Stencil
https://www.npmjs.com/package/@stencil-community/postcss
Other
30 stars 24 forks source link

Postcss is not a function error #9

Closed gavinmcfarland closed 6 years ago

gavinmcfarland commented 6 years ago

I tried following the documentation but it changes from es6 to es5 part way through. I tried adapting it but I get the error postcss is not a function TypeError: postcss is not a function at Object when I run npm start.

const config = require('@stencil/core');
const postcss = require('@stencil/postcss');
const autoprefixer = require ('autoprefixer')

exports.config = {
  plugins: [
    postcss([
      autoprefixer()
    ])
  ],
  outputTargets: [
    {
      type: 'www',
      serviceWorker: {
        swSrc: 'src/sw.js',
        globPatterns: [
          '**/*.{html,js,css,json,ico,png}'
        ]
      }
    }
  ],
  globalStyle: 'src/global/style.scss',
  copy: [
    { src: 'docs-content/' },
    { src: 'robots.txt' }
  ]
};

exports.devServer = {
  root: 'www',
  watchGlob: '**/**'
};

The Stencil repo doesn't include a config file so I can't and I couldn't get server running on it so I used the Stecnil Site example but its config file is written in es5.

gavinmcfarland commented 6 years ago

Ok, I've worked out the problem. So many errors that it's just one cluster of confusion. I tried installing Stencil using the main repo but running npm start prompt to bootstrap an app or component didn't happen (like I think it should?). I therefore just can't get Stencil running using the main repo. I was then using the Stencil site to see if I had any more luck but this is using es5 and the lastest version of stencil-postcss uses es6 so both are incompatible. Using an earlier version of stencil-poscss works.

I'm still however trying to use the lastest version of Stencil but just can't get it working with the main repo. Setting up from the other repos like stencil-app-starter works however.